Documentation

The Java™ Tutorials
Hide TOC
Using Multiple Entry Points
Trail: Deployment
Lesson: Deploying Self-Contained Applications

Using Multiple Entry Points

Self-contained applications are useful when you have a set of related applications that you want users to deploy. A self-contained application provides a single, installable bundle that installs all of the applications and the JRE needed to run them.

The Multiple Launchers Demo includes the Dynamic Tree Demo described in Converting an Existing Application and the File Association Demo described in Using File Associations. The /src directory of the project contains the source file for both applications.

You can download the source files for the Multiple Launchers Demo from Self-Contained Application Examples.

The primary entry point for a self-contained application is identified by the mainClass attribute of the <fx:application> element. In the Multiple Launchers Demo, the primary entry point is the File Association Demo. The main class is sample.fa.ScriptRunnerAppliation for Linux and Windows, or sample.fa.ScriptRunnerApplicationMac for OS X. See Using a Common Build File for All Platforms for information on how the class to use is determined when a single build file is used across platforms.

Each secondary entry point is identified by an instance of the <fx:secondaryLauncher> element. See <fx:secondaryLauncher> for information about this element.

In the Multiple Launchers Demo, the secondary entry point is the Dynamic Tree Demo. The following code in the build.xml file shows how the second entry point is defined:

<fx:secondaryLauncher name="Dynamic Tree Demo"
    mainClass="webstartComponentArch.DynamicTreeApplication"
    version="1.0"
    title="Dynamic Tree Demo"
    vendor="My Company"
    description="A Demo of Multiple Launchers for JavaPackager"
    copyright="(c) 2014 My Company"
     menu="true"
     shortcut="false"
     >
</fx:secondaryLauncher>

See build.xml for the complete build code.

To generate the installable bundles for the Multiple Launchers Demo, see the "Generating the Bundles" section in Converting an Existing Application.

When your self-contained application is installed, the File Association Demo is installed with the Multiple Launchers entry point and the Dynamic Tree Demo is installed with its own entry point. For example, on Windows, the Java Demos folder in the Start menu contains two entries: Dynamic Tree Demo and Multiple Launchers Demo. Note that file associations are set up for the Multiple Launchers entry point, so opening a JavaScript or Groovy file starts Multiple Launchers.

Additional Resources

For more information about multiple entry points, see Supporting Multiple Entry Points.

For more information about JavaFX Ant arguments, see JavaFX Ant Task Reference.


Previous page: Using a Common Build File for All Platforms
Next page: Questions and Exercises: Self-Contained Applications