4

我正在尝试从可从官方 JafaFX 下载页面下载的 JavaFX 2.1.0 示例应用程序包构建 DataApp 示例应用程序:
http ://www.oracle.com/technetwork/java/javafx/downloads/index.html

我正在为 JDK6 使用 Netbeans 7.1.2、JDK6 和 JavaFX 2.1.0。

在 NetBeans 中,当我右键单击 DataApp 服务器并从上下文菜单中选择运行时,我得到以下输出:

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)

有人知道这个错误吗?

它可能与 Ant 有某种关系吗?

以下几行是什么意思?

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.

谢谢!

更新:显然问题是通过手动修改位于 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:\Soft\javafx_sdk_2.1\lib\ant-javafx.jar" />

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

...

这可能是此示例应用程序的正式版本中的错误,还是我的设置有问题?

4

2 回答 2

3

显然,通过手动修改位于 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:\Soft\javafx_sdk_2.1\lib\ant-javafx.jar" />

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

...
于 2013-05-31T14:17:12.380 回答
2

任何有类似错误的人。尝试以下解决方案(它对我有用),我在这里找到它https://groups.google.com/forum/#!msg/efxclipse/H-ZOVXtaK6g/5yufMqQsZBQJ

解决方案

我设法通过转到运行->外部工具_>外部工具配置并选择 JRE 选项卡来使其工作。我不得不将执行环境从 1.7 更改为 CDC-1.0/Foundation-1.0 (jdk1.7.0_25)(CDC-1.1 也可以工作)。

错误-

BUILD FAILED
C:\Users\Ross\workspace\MyJavaFXApp\build\build.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
于 2013-08-09T02:17:27.660 回答