简体   繁体   English

无法构建JavaFX 2.1.0示例应用程序 - DataApp - 无法创建任务或输入javafx:com.sun.javafx.tools.ant:application

[英]cannot build JavaFX 2.1.0 sample application - DataApp - failed to create task or type javafx:com.sun.javafx.tools.ant:application

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

I am using Netbeans 7.1.2, JDK6 and JavaFX 2.1.0 for JDK6. 我正在为JDK6使用Netbeans 7.1.2,JDK6和JavaFX 2.1.0。

In NetBeans, when I right-click on the DataApp server and select Run from the context menu, I get the following output: 在NetBeans中,当我右键单击DataApp服务器并从上下文菜单中选择Run时,我得到以下输出:

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 ? 它可能与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.

Thank you! 谢谢!

Update: Aparently the problem is solved by manually modifying the Ant build.xml file located in the DataAppClient project root. 更新:通常通过手动修改位于DataAppClient项目根目录中的Ant build.xml文件来解决问题。
I added a taskdef tag at the beginning of the -post-jar target definition and the error was gone: 我在-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}"/>

...

Can this be an error in the official release of this sample application, or something is wrong with my setup ? 这可能是此示例应用程序正式版本中的错误,或者我的设置有问题吗?

Aparently the problem is solved by manually modifying the Ant build.xml file located in the DataAppClient project root. 显然,通过手动修改位于DataAppClient项目根目录中的Ant build.xml文件可以解决该问题。
I added a taskdef tag at the beginning of the -post-jar target definition and the error was gone: 我在-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}"/>

...

Anyone who has a similar error. 任何有类似错误的人。 Try the following solution (it worked for me), I found it here https://groups.google.com/forum/#!msg/efxclipse/H-ZOVXtaK6g/5yufMqQsZBQJ 尝试以下解决方案(它对我有用),我在这里找到它https://groups.google.com/forum/#!msg/efxclipse/H-ZOVXtaK6g/5yufMqQsZBQJ

The Solution 解决方案

I managed to get it to work by going to Run->External Tools_>External Tools Configurations and selecting JRE Tab. 我设法通过运行 - >外部工具_>外部工具配置并选择JRE选项卡来使其工作。 I had to change the Execution environment from 1.7 to CDC-1.0/Foundation-1.0 (jdk1.7.0_25) (and CDC-1.1 also works). 我不得不将执行环境从1.7更改为CDC-1.0 / Foundation-1.0(jdk1.7.0_25)(并且CDC-1.1也可以)。

The Error- 错误-

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JavaFX 11 部署失败:无法创建任务或键入 javafx:com.sun.javafx.tools.ant:fileset - JavaFX 11 Deployment Failure: failed to create task or type javafx:com.sun.javafx.tools.ant:fileset 无法使用Ant构建JavaFX应用程序 - Cannot build JavaFX application using Ant JavaFX:线程“JavaFX 应用程序线程”中的异常 java.lang.NullPointerException:无法调用“com.sun.prism.GraphicsPipeline.is3DSupported()” - JavaFX: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot invoke "com.sun.prism.GraphicsPipeline.is3DSupported()" JavaFX 应用程序启动失败 - JavaFX Failed to start Application 无法建立JavaFX应用程序 - Unable to build JavaFX Application 我想用 Ant 构建 JavaFx 应用程序的 MSI 安装程序 - I want to build an MSI installer of a JavaFx application with Ant javafx DataApp演示中的数据库错误 - Error with database in javafx DataApp demo 在 NetBeans 9 和 11 中打包为 DMG 图像,JDK 11 返回“typedef class com.sun.javafx.tools.ant.FXJar cannot be found using the..” - Package as DMG Image in NetBeans 9 & 11, JDK 11 returns "typedef class com.sun.javafx.tools.ant.FXJar cannot be found using the.." JavaFX应用程序线程进行任务通信 - JavaFX Application Thread to Task Communication 无法访问类 com.sun.javafx.util.Utils(在模块 javafx.graphics 中)-JavaFX 和 Eclipse - Cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) - JavaFX & Eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM