Java Reference
In-Depth Information
Automating your JavaFX build with Ant
The simplest (and safest) way to integrate the JavaFX build process with your automated Ant
build is to use the exec Ant task to invoke the javafxpackager tool as an out-of-process
task. Assuming that both Ant and JavaFX SDK are installed properly and are a part of the
command shell's execution path, you can invoke the javafxpackager tool to compile the code
mentioned earlier in this recipe using the Ant build below. Refer to ch07/source-code/
fxbuild.xml for the build file.
<?xml version="1.0" encoding="UTF-8"?>
<project name="JavaFX-Build" default="compile" basedir=".">
<target name="compile">
<echo message="Compiling JavaFX"/>
<exec executable="javafxpackager" failonerror="true">
<arg value="-src"/>
<arg value="src"/>
<arg value="-appClass"/>
<arg value="cookbook.app.Main"/>
</exec>
</target>
</project>
Using the exec Ant task, we are able to invoke the javafxpackager tool and passing
control parameters to it as if it is invoked from the command line. When the Ant build file
is executed, you get the same result as described in the How to do it section.
The other way to do this is to use the JavaFXAntTask class found in the com.sun.
tools.javafx.ant package. This approach, however, relies on the use of internal,
non-documented Sun's private classes. Although it works today, there is no guarantee
that it will work, or even be supported, later on. Nevertheless, it is there and can be
used to achieve the same result as above.
See also
F Chapter 1 , Getting Started with Ja vaFX
Packaging your app to be Web Start(ed)
You have couple of options when it comes to distributing your JavaFX desktop applications.
The first option is to ship your app to your users as raw JAR files launched from the command
line. While this gives the application full access to local resources. However, it is not officially
supported (as of version 1.2) and will run the code unmanaged and unable to take advantage
of the deployment services, such as auto-update, JRE detection, and so on.
 
Search WWH ::




Custom Search