How-To's > How do I deploy my application?


You can deploy your JavaFX application as follows:

You can easily package and deploy any of these types of applications in the NetBeans IDE, which automatically generates the appropriate files for the type of application you choose. As an alternative, you can use the JavaFX Packager tool and other commands included with the JavaFX SDK, as described in the following sections. See the links at the end of this topic for more detailed information about how to package and deploy JavaFX applications.

Stand-Alone Desktop Application

Compile your desktop application by using the javafxc command. Run the application by using the javafx command.

Java Web Start Application

To deploy your application as a Java Web Start application, package all classes and resources for your application in one or more JAR files. Then create a JNLP file for your application. Install the JAR and JNLP files on a server. Then add a link to your HTML page to launch your Java Web Start application.

If you build the application in the NetBeans IDE, you need only to edit the JNLP file so that the codebase element contains a correct URL that points to the location of this JNLP file. Outside of the NetBeans IDE, use the JavaFX Packager tool.

Applet

To deploy your applet, create application_name.jar and application_name_browser.jnlp files and install them on a server. If you use the NetBeans IDE to generate the appropriate files, edit the codebase and homepage variables in application_name_browser.jnlp file to point to the correct location of the application files and to the HTML page where the applet appears.

Embed the applet in your HTML page by inserting the following markup in the position at which the applet appears:

<script src="http://dl.javafx.com/1.2/dtfx.js"></script>
<script>
    javafx(
        {
            archive: "Rollover.jar",
              draggable: true,
              width: 280,
              height: 100,
              code: "rollover.Main",
              name: "Rollover"
        }
    );
</script>

Notes:

  • Ensure that the first script tag contains the URL for dl.java.com with the correct version number.
  • The draggable variable refers to whether the viewer can drag the applet from the browser to the desktop. This feature is available with Java SE Version 6 Update 10 release at minimum, installed on the viewer's system.
  • The width and height variables should match the size of your stage, in pixels.
  • The code variable contains the entry point to your code. In the example, the package name is rollover and the entry point is Main.fx.
  • The name variable contains the name of the application, and it should match the name of the main JAR file.

Mobile Application

Ensure that you use the JavaFX API common profile when you develop your application. Otherwise, your application will not run on the mobile platform. To test your application, you can use the JavaFX Mobile Emulator embedded in the NetBeans IDE, which is currently available on the Windows platform. You can download the NetBeans IDE from the javafx.com web site.

Related Links

Last Updated: April 2010
[Return to How-To's Home]