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:
http://www.oracle.com/technetwork/java/javafx/downloads/index.html

我用Netbeans 7.1.2, JDK6和JavaFX 2.1.0 来交换JDK6。

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

check-mysql-drivers-installed:
init:
deps-module-jar:
DataAppClient.init:
Deleting: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuilduilt-jar.properties
DataAppClient.deps-jar:
Updating property file: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuilduilt-jar.properties
DataAppLibrary.init:
DataAppLibrary.deps-jar:
Updating property file: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuilduilt-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.0srcDataAppDataAppClient
bprojectjfx-impl.xml and again in D:Softjavafx-samples-2.1.0srcDataAppDataAppPreloader
bprojectjfx-impl.xml
DataAppPreloader.init:
DataAppPreloader.deps-jar:
Updating property file: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuilduilt-jar.properties
DataAppPreloader.compile:
Copying 1 file to D:Softjavafx-samples-2.1.0srcDataAppDataAppPreloaderuild
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.0srcDataAppDataAppClientuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-core-asl-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-jaxrs-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-mapper-asl-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjackson-xc-1.7.1.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjersey-client-1.8.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjersey-core-1.8.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuildclasses
Expanding: D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlibjersey-json-1.8.jar into D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuildclasses
Deleting directory D:Softjavafx-samples-2.1.0srcDataAppDataAppClientdistlib
D:Softjavafx-samples-2.1.0srcDataAppDataAppServer
bprojectuild-impl.xml:559: The following error occurred while executing this line:
D:Softjavafx-samples-2.1.0srcDataAppDataAppClientuild.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.0srcDataAppDataAppClientuild.xml:48: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:application
Cause: The name is undefined.

谢谢!

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:Softjavafx_sdk_2.1libant-javafx.jar" />

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

...

这是否是官方发布此试样应用程序时的错误, 还是我的设置有问题?

最佳回答

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:Softjavafx_sdk_2.1libant-javafx.jar" />

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

...
问题回答

任何有类似错误的人。 尝试以下的解决方案( 对我有效), 我在这里发现它 < href=" https://groups.google.com/forum/#!msg/efxclipse/ H- ZOVXtaK6g/5yufMqQsZBQJ" rel=“ nofollow” >https://groups.google.com/forum/#msg/efxclipse/ H- ZOVXtaK6g/forum/#!msg/efxclipse/ H- ZOVXtaKK6g/yufMqQsZBQJ

解决方案

我设法通过运行 & gt; 外部工具@gt; 外部工具配置和选择 JRE Tab 来让它发挥作用。 我不得不将执行环境从1.7 改为 CDC-1.0/Foundation-1.0 (jdk1. 7. 0_25) (CDC-1.1) (和CDC-1.1) 也有效 ) 。

错误 -

BUILD FAILED
C:UsersRossworkspaceMyJavaFXAppuilduild.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




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签