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.
- 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.
- Navigate to the project's
distfolder. - Type the following at the command prompt:
whereSource Code<javafx-sdk-install-dir>/bin/javafx -classpath SpringAnimation.jar custominterpolator.SpringDemo
custominterpolator.SpringDemois 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, thejavafxbinary 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".
-
- To deploy the application outside of the IDE project folders:
- Copy the
<application_name>.jarfile (for our example,SpringAnimation.jarfile) and the user library class files, if any, from thedist/libfolder. Paste them to a location from which you want to deploy the application. - Deploy by using the commands in step 3.
- Copy the
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.
- 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.
- Navigate to the project's
distfolder and do one of the following:
- Double-click the
SpringAnimation.jnlpfile - Type the following at the command prompt:
Source Codejavaws SpringAnimation.jnlp
- Double-click the
- To deploy the application outside of the IDE project's folders, do the following:
- Copy the following files from
distfolders and paste them to a location from which you want to deploy the application.
<application_name>.jnlp- for example,SpringAnimation.jnlpfor this sample project
<application_name>.jar
<application_name>.jar.pack.gz,if Pack200 Compression was enabled
- Edit the
codebasetag in the<application_name>.jnlpfile to indicate the server and directory location from where the application is to be invoked. - Invoke the
<application_name>.jnlpby using thejavawscommand, as shown in step 2 of this section.
- Copy the following files from
- To deploy the application from a browser, provide a link to the
<application_name>.jnlpfile in your web page.
For example, add the following line to invoke a local copy of theSpringAnimation.jnlpfile 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.
- 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.
- Navigate to the project's
distfolder and edit the<application_name>_browser.jnlpfile so that the codebase tag specifies the server and directory location from where the applet is to be served. - Double-click the the
<application_name>.htmlfile.
A separate browser window is displayed for running the Spring Animation application. - To deploy outside of the IDE project's folders, do the following:
- Copy the following files from
distfolders and into a folder from which you want to invoke the applet.
<application_name>.html- for example,SpringAnimation.htmlfor this sample project
<application_name>_browser.jnlp
<application_name>.jar
<application_name>.jar.pack.gz,if Pack200 Compression was enabled
- (Optional) Copy the contents of the
<application_name>.htmlfile into your own web page to invoke the application from your own web page. - Navigate to where you copied the application files and invoke the IDE-generated
<application_name>.htmlfile (or your modified web page file) to run the application outside of the IDE.
- Copy the following files from
Cindy Castillo
Technical Writer, Oracle Corporation