Cannot create sample JavaFX 2.1.0 application - DataApp - could not create task or enter javafx: com.sun.javafx.tools.ant: application

I am trying to create a DataApp sample application from the sample JavaFX 2.1.0 application package downloaded from the official JafaFX download page:
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.

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 anyone know about this error?

Could this be 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. 

Thanks!

Update: Apparently, the problem is solved by manually modifying the Ant build.xml file located in the root of the DataAppClient project.
I added the taskdef tag at the beginning of the goal definition -post-jar, and the error went away:

 ... <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}"/> ... 

Could it be a mistake in the official release of this sample application, or is there something wrong with my setup?

+4
source share
2 answers

Apparently, the problem is solved by manually modifying the Ant build.xml file located in the root of the DataAppClient project.
I added the taskdef tag at the beginning of the goal definition -post-jar, and the error went away:

 ... <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}"/> ... 
+3
source

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

Decision

I managed to get it to work by going to Run-> External Tools_> External Tools Configurations and selecting the JRE tab. 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 works).

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 
+2
source

Source: https://habr.com/ru/post/1414363/


All Articles