我正在尝试从可从JafaFX官方下载页面下载的JavaFX 2.1.0示例应用程序包构建DataApp示例应用程序:
http://www.oracle.com/technetwork/java/javafx/downloads/index.html
我正在使用 Netbeans 7.1.2、JDK6 和 JavaFX 2.1.0 for JDK6。
在 NetBeans 中,当我右键单击 DataApp 服务器并从上下文菜单中选择"运行"时,将得到以下输出:
check-mysql-drivers-installed:
init:
deps-module-jar:
DataAppClient.init:
Deleting: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildbuilt-jar.properties
DataAppClient.deps-jar:
Updating property file: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildbuilt-jar.properties
DataAppLibrary.init:
DataAppLibrary.deps-jar:
Updating property file: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildbuilt-jar.properties
DataAppLibrary.compile:
Copy libraries to D:Softjavafx-samples-2.1.0srcDataAppDataAppLibrarydistlib.
To run this application from the command line without Ant, try:
java -jar "D:Softjavafx-samples-2.1.0srcDataAppDataAppLibrarydistDataAppLibrary.jar"
DataAppLibrary.jar:
Duplicated project name in import. Project jfx-impl defined first in D:Softjavafx-samples-2.1.0srcDataAppDataAppClientnbprojectjfx-impl.xml and again in D:Softjavafx-samples-2.1.0srcDataAppDataAppPreloadernbprojectjfx-impl.xml
DataAppPreloader.init:
DataAppPreloader.deps-jar:
Updating property file: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildbuilt-jar.properties
DataAppPreloader.compile:
Copying 1 file to D:Softjavafx-samples-2.1.0srcDataAppDataAppPreloaderbuild
Copy libraries to D:Softjavafx-samples-2.1.0srcDataAppDataAppPreloaderdistlib.
To run this application from the command line without Ant, try:
C:jdk1.6.0_30/bin/java -jar "D:Softjavafx-samples-2.1.0srcDataAppDataAppPreloaderdistDataAppPreloader.jar"
Deleting directory D:Softjavafx-samples-2.1.0srcDataAppDataAppPreloaderdistlib
Detected JavaFX Ant API version 1.1
DataAppPreloader.jfx-deployment:
DataAppPreloader.jar:
DataAppClient.compile:
Copying 27 files to D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlib
Moving 1 file to D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdist
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibDataAppLibrary.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-core-asl-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-jaxrs-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-mapper-asl-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-xc-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjersey-client-1.8.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjersey-core-1.8.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjersey-json-1.8.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuildclasses
Deleting directory D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlib
D:Softjavafx-samples-2.1.0srcDataAppDataAppServernbprojectbuild-impl.xml:559: The following error occurred while executing this line:
D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuild.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)
有人对这个错误有任何想法吗?
会不会和蚂蚁有某种关系?
以下几行是什么意思?
The following error occurred while executing this line:
D:Softjavafx-samples-2.1.0srcDataAppDataAppClientbuild.xml:48: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:application
Cause: The name is undefined.
谢谢!
更新:通过手动修改位于 DataAppClient 项目根目录中的 Ant 构建.xml文件,可以解决此问题。
我在 -post-jar 目标定义的开头添加了一个 taskdef 标签,但错误消失了:
...
<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:Softjavafx_sdk_2.1libant-javafx.jar" />
<!-- Move preloader out of libs -->
<move file="${dist.dir}/lib/DataAppPreloader.jar" todir="${dist.dir}"/>
...
这可能是此示例应用程序的正式版本中的错误,还是我的设置有问题?
通过手动修改位于 DataAppClient 项目根目录中的 Ant build.xml 文件,可以解决此问题。
我在 -post-jar 目标定义的开头添加了一个 taskdef 标签,但错误消失了:
...
<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:Softjavafx_sdk_2.1libant-javafx.jar" />
<!-- Move preloader out of libs -->
<move file="${dist.dir}/lib/DataAppPreloader.jar" todir="${dist.dir}"/>
...
任何有类似错误的人。尝试以下解决方案(它对我有用),我在这里找到了它 https://groups.google.com/forum/#!msg/efxclipse/H-ZOVXtaK6g/5yufMqQsZBQJ
解决方案
我设法通过转到运行>外部Tools_>外部工具配置并选择 JRE 选项卡来使其工作。 我不得不将执行环境从 1.7 更改为 CDC-1.0/Foundation-1.0 (jdk1.7.0_25)(CDC-1.1 也可以)。
错误-
BUILD FAILED
C:UsersRossworkspaceMyJavaFXAppbuildbuild.xml:87: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:resources
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