Deploying the JavaFX Application Outside of the IDE


In this section, you use the files generated by the IDE for each of the execution models to execute the Spring Animation application outside of the IDE.

Executing a Stand-alone Desktop Application From the Command Line

Now that the IDE has packaged the files necessary to run the application outside of the IDE, use the following steps to execute Spring Animation as a stand-alone application at the command line.

  1. Generate the necessary files to run Spring Animation as a stand-alone desktop application by following the steps in the Using the Standard Execution Model section previously.

  2. Navigate to the project's dist folder.

  3. Type the following at the command prompt:
    Source Code
    <javafx-sdk-install-dir>/bin/javafx -classpath SpringAnimation.jar custominterpolator.SpringDemo
    
    
    where custominterpolator.SpringDemo is the name of the main JavaFX class and javafx-sdk-install-dir is the path to where the JavaFX SDK is installed. In a default installation of NetBeans IDE for JavaFX, the javafx binary can be found in the following locations:

    • /Applications/NetBeans/NetBeans\ version.app/Contents/Resources/NetBeans/javafx2/javafx-sdk/bin/javafx (on the Mac OS X platform)

    • <NB-install-dir>\javafx2\javafx-sdk\bin\javafx (on the Windows platform)

      If the NetBeans installation path contains spaces, enclose the path in quotes. For example, "C:\Program Files\NetBeans version\javafx2\javafx-sdk\bin\javafx".

  4. To deploy the application outside of the IDE project folders:

    1. Copy the <application_name>.jar file (for our example, SpringAnimation.jar file) and the user library class files, if any, from the dist/lib folder. Paste them to a location from which you want to deploy the application.

    2. Deploy by using the commands in step 3.

Executing the Application Using Java Web Start

Use the following steps to execute Spring Animation as a stand-alone application by using Java Web Start from the command line.

  1. Generate the necessary files to run Spring Animation using Java Web Start by following the steps in the Using the Java Web Start Execution Model section previously.

  2. Navigate to the project's dist folder and do one of the following:

    • Double-click the SpringAnimation.jnlp file

    • Type the following at the command prompt:
      Source Code
      javaws SpringAnimation.jnlp
      
      
  3. To deploy the application outside of the IDE project's folders, do the following:

    1. Copy the following files from dist folders and paste them to a location from which you want to deploy the application.

        <application_name>.jnlp - for example, SpringAnimation.jnlp for this sample project
        <application_name>.jar
        <application_name>.jar.pack.gz, if Pack200 Compression was enabled

    2. Edit the codebase tag in the <application_name>.jnlp file to indicate the server and directory location from where the application is to be invoked.

    3. Invoke the <application_name>.jnlp by using the javaws command, as shown in step 2 of this section.

  4. To deploy the application from a browser, provide a link to the <application_name>.jnlp file in your web page.

    For example, add the following line to invoke a local copy of the SpringAnimation.jnlp file from your web page.
    Source Code
    <a href="SpringAnimation.jnlp">Launch Spring Animation</a>
    
    

Executing a JavaFX Applet Outside of the IDE

Now that the IDE has packaged the files necessary to run the Spring Animation application outside of the IDE, use the following steps to execute it as an applet from the command line.

  1. Generate the necessary files to run Spring Animation as a JavaFX applet in a browser by following the steps in Using the Run In Browser Execution Model section.

  2. Navigate to the project's dist folder and edit the <application_name>_browser.jnlp file so that the codebase tag specifies the server and directory location from where the applet is to be served.

  3. Double-click the the <application_name>.html file.

    A separate browser window is displayed for running the Spring Animation application.

  4. To deploy outside of the IDE project's folders, do the following:

    1. Copy the following files from dist folders and into a folder from which you want to invoke the applet.

        <application_name>.html - for example, SpringAnimation.html for this sample project
        <application_name>_browser.jnlp
        <application_name>.jar
        <application_name>.jar.pack.gz, if Pack200 Compression was enabled

    2. (Optional) Copy the contents of the <application_name>.html file into your own web page to invoke the application from your own web page.

    3. Navigate to where you copied the application files and invoke the IDE-generated <application_name>.html file (or your modified web page file) to run the application outside of the IDE.