本文介绍了不能建立的JavaFX 2.1.0示例应用程序 - DataApp - 未能创建任务或类型的JavaFX:com.sun.javafx.tools.ant:应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立从官方JafaFX下载页面了JavaFX 2.1.0示例应用程序包下载的DataApp示例应用程序:结果

I am trying to build the DataApp sample application from the JavaFX 2.1.0 sample application pack downloadable from the official JafaFX downloads page:
http://www.oracle.com/technetwork/java/javafx/downloads/index.html

我使用NetBeans 7.1.2,JDK6和JavaFX 2.1.0为JDK6。

I am using Netbeans 7.1.2, JDK6 and JavaFX 2.1.0 for JDK6.

在NetBeans中,在DataApp服务器上,当我用鼠标右键单击,然后从上下文菜单中选择运行,我得到以下的输出:

In NetBeans, when I right-click on the DataApp server and select Run from the context menu, I get the following output:

check-mysql-drivers-installed:
init:
deps-module-jar:
DataAppClient.init:
Deleting: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppClient.deps-jar:
Updating property file: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppLibrary.init:
DataAppLibrary.deps-jar:
Updating property file: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppLibrary.compile:
Copy libraries to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppLibrary\dist\lib.
To run this application from the command line without Ant, try:
java -jar "D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppLibrary\dist\DataAppLibrary.jar"
DataAppLibrary.jar:
Duplicated project name in import. Project jfx-impl defined first in D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\nbproject\jfx-impl.xml and again in D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\nbproject\jfx-impl.xml
DataAppPreloader.init:
DataAppPreloader.deps-jar:
Updating property file: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\built-jar.properties
DataAppPreloader.compile:
Copying 1 file to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\build
Copy libraries to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\dist\lib.
To run this application from the command line without Ant, try:
C:\jdk1.6.0_30/bin/java -jar "D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\dist\DataAppPreloader.jar"
Deleting directory D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppPreloader\dist\lib
Detected JavaFX Ant API version 1.1
DataAppPreloader.jfx-deployment:
DataAppPreloader.jar:
DataAppClient.compile:
Copying 27 files to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib
Moving 1 file to D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\DataAppLibrary.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-core-asl-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-jaxrs-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-mapper-asl-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jackson-xc-1.7.1.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jersey-client-1.8.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jersey-core-1.8.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Expanding: D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib\jersey-json-1.8.jar into D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build\classes
Deleting directory D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\dist\lib
D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppServer\nbproject\build-impl.xml:559: The following error occurred while executing this line:
D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build.xml:48: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:application
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
BUILD FAILED (total time: 6 seconds)

没有任何人有这个错误的任何想法?

Does anybody have any idea about this error?

难道是主题相关的蚂蚁?

Could it be somehow related to Ant ?

什么是以下行是什么意思?

What do the following lines mean?

The following error occurred while executing this line:
D:\Soft\javafx-samples-2.1.0\src\DataApp\DataAppClient\build.xml:48: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:application
Cause: The name is undefined.

感谢您!

更新:
Aparently问题通过手动修改位于DataAppClient项目根Ant build.xml文件解决了。结果
我在-post-jar目标定义的开头加了的taskdef标记和错误走了:

Update:Aparently the problem is solved by manually modifying the Ant build.xml file located in the DataAppClient project root.
I added a taskdef tag at the beginning of the -post-jar target definition and the error was gone:

...

<target name="-post-jar" depends="-init-javafx, -jfx-copylibs">

    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
             uri="javafx:com.sun.javafx.tools.ant"
             classpath="d:\Soft\javafx_sdk_2.1\lib\ant-javafx.jar" />

    <!-- Move preloader out of libs -->
    <move file="${dist.dir}/lib/DataAppPreloader.jar" todir="${dist.dir}"/>

...

可这是在此示例应用程序的正式发布错误,什么是错的我的设置?

Can this be an error in the official release of this sample application, or something is wrong with my setup ?

推荐答案

Aparently问题通过手动修改位于DataAppClient项目根Ant build.xml文件解决了。结果
我在-post-jar目标定义的开头加了的taskdef标记和错误走了:

Aparently the problem is solved by manually modifying the Ant build.xml file located in the DataAppClient project root.
I added a taskdef tag at the beginning of the -post-jar target definition and the error was gone:

...

<target name="-post-jar" depends="-init-javafx, -jfx-copylibs">

    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
             uri="javafx:com.sun.javafx.tools.ant"
             classpath="d:\Soft\javafx_sdk_2.1\lib\ant-javafx.jar" />

    <!-- Move preloader out of libs -->
    <move file="${dist.dir}/lib/DataAppPreloader.jar" todir="${dist.dir}"/>

...

这篇关于不能建立的JavaFX 2.1.0示例应用程序 - DataApp - 未能创建任务或类型的JavaFX:com.sun.javafx.tools.ant:应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 12:51