JavaFX 2.0 Beta Packager Tool Now Available

The latest JavaFX 2.0 Beta Build 38 release contains an interim version of the JavaFX Packager tool, an executable file in the \bin directory of the JavaFX SDK. This blog gives you some preliminary information about this tool. For other information about JavaFX deployment, see Deploying JavaFX Applications.

The tool can be invoked in either of two ways:

  • From the command line
    Set the Windows PATH environment variable to the \bin directory of your JavaFX SDK installation, then at the command line enter javafxpackagers with no options, which displays the help.

  • Using Ant tasks
    You can use the options from the javafxpackager command in your Ant tasks. See the example in Using the JavaFX Packager Tool with Ant Tasks.

The JavaFX Packager tool performs any of the following tasks from the command line or in Ant scripts:

Table 1 Types of Commands in javafxpackager Command and Ant Tasks

Task and Description Description javafxpackager Command
Ant Task/Class

Make All

  • Compiles source files
  • Runs the Create JAR task.
  • Runs the Deploy task


(Not Available)

Create a JAR Archive

  • Creates a JAR archive from compiled source files
  • Creates binary files from any CSS files


FXJar task, FXJar class

Deploy (Generate Files for Web Deployment)

  • Generates JNLP and HTML files for web deployment


DeployFXTask class

Convert CSS Files to Binary Format

  • Only converts CSS files to binary format


CSSToBinTask class

Sign JAR Files

  • Digitally signs JAR files with a certificate

(Not available in this release)

FXSignJarTask class

JavaFX Packager Commands

The following sections contain a description of the commands listed in Table 1.

Make All

The command-line version of the JavaFX Packager tool has a -makeall command, which is a convenience command to produce deployment files with minimal configuration. The -makeall command performs the following tasks:

  • Compiles the source files

  • Runs the -createjar command, which includes converting the CSS files to their binary form.

  • Runs the -deploy command, which generates the JNLP and HTML files.

  • Converts the CSS files to their binary form.

The -makeall command presumes all the application sources are located in the src directory and places the result files in the dist directory. You can set a limited number of other options, described in the command line help.

Prior to calling the packaging (Create Jar) and deployment tasks, the -makeall command compiles the source files as well. For compilation, it searches for a JDK installation in directories specified by the JAVA_HOME or java.home system variables and for a JavaFX SDK installation in directories specified by the JAVAFX_HOME or javafx.home system variables.

Create a JAR Archive

The Create JAR command in the JavaFX Packager tool packages files into an executable JAR file that contains the application. Other options you can set are described in the command line help.

By default, the Create JAR command also includes the JavaFX Launcher in the JAR archive. The JavaFX Launcher is responsible for locating the installed JavaFX Runtime and invoking the main application class using this Runtime. Use the -noembedlauncher option to keep the launcher from being embedded.

Deploy (Generate Files for Web Deployment)

The Deploy command generates HTML and JNLP files for web deployment scenarios. You can set the options described in the command line help. For more information about web deployment files, see Deploying JavaFX Application Files in the Deploying JavaFX Applications.

Convert CSS Files to Binary Format

Converting CSS files to binary form is by default included in the -createjar command functionality, but the -createbss command can be invoked independently if you only want to convert CSS files to binary form. You can specify the input and output files as options. See the command line help for the list of options.

Sign JAR Files

This command, currently available only through an Ant task, signs a JAR file with a certificate you provide. There are options to specify the keystore file, key alias in the keystore, keystore password, key password, and type of keystore. See the <fxsignjar> element in the example Ant script below.

About Source Files

The type of source files required for each command is shown in the following table.

Table 2 Source File Types According to Command or Task Type

Command Type Source File Types

Make All (command line only)

JavaFX code files and other application resources

Create Jar

Classes and other application resources


JAR files and resources

Create BSS

CSS files

For Ant tasks, the source files for all commands are specified by the standard Ant fileset element, and for the command line interface the source files are specified by a combination of the -srcdir and -srcfiles parameters.

The -srcfiles option works in a similar manner as the Ant include option of the fileset element, in that if it is not present, all files in the preceding -srcdir are included, and if it is present, only files listed are included. For example, the following option includes both the temp\out.jar file and the content of the temp\dir2 and tmp directories:

-srcdir temp -srcfiles out.jar;dir2 -srcdir tmp

The command line version does not support advanced features of Ant, such as the **/*.html notation.

Using the JavaFX Packager Tool with Ant Tasks

Ant tasks can be configured in the same way as the javafxpackager command line options. The following example shows how the tasks and command line options are used in elements and attributes. Stay tuned for more documentation, coming soon.

Example 3-1 Ant Task Example Using JavaFX Packager Tool Options

<project name="HelloWorld" default="do-deploy" basedir=".">
    <target name="app-config">
        <property name="applet.width" value="600"/>

        <property name="applet.height" value="450"/>
    <target name="init-fx-tasks">
        <property name=""
        <taskdef name="fxdeploy"
        <taskdef name="fxjar"

        <taskdef name="fxsignjar"
    <target name="do-deploy" depends="app-config, init-fx-tasks">
        <delete file="jar/HelloWorld.jar"/>
        <fxjar destfile="jar/HelloWorld.jar"
               applicationClass="helloworld.HelloRectangle" >
            <fileset dir="classes"/>

              <attribute name="Implementation-Vendor" value="FX Team"/>
              <attribute name="Implementation-Title" value="HelloWorld"/>
              <attribute name="Implementation-Version" value="1.0"/>

        <fxdeploy width="${applet.width}" height="${applet.height}"
                  outdir="deploy" embedJNLP="true"
            <info title="HelloWorld"
                  vendor="FX Team"/>
            <application name="HelloWorld"
            <resources type="eager">
               <fileset dir="jar">
                  <include name="HelloWorld.jar"/>

        <genkey alias="TestAlias" storepass="xyz123" 
            dname="CN=Deploy, OU=JavaFX Dev, O=Oracle, C=US"/>
        <fxsignjar keystore="sign/test.keystore" alias="TestAlias" 
            storepass="xyz123" destDir="sign">
           <fileset file="jar/HelloWorld.jar"/>


Post a Comment:
  • HTML Syntax: NOT allowed

Blog about Java technology documentation and news about Java releases.


« April 2014