Java Reference
In-Depth Information
When the project is built, besides generating the JAR file, two JNLP deployment
files will be generated, one used for applet deployment, and the other used for
Java Web Start deployment. Java Web Start uses the same protocol as applets,
but allows the user the ability to start the application from his desktop without
using the browser, even though the application itself is downloaded. These will
be explained in detail in the next sections. Besides the JNLP deployment files, a
sample HTML file is produced with the appropriate JavaScript code to launch
the applet. This file can be used for testing, and the JavaScript launcher code can
be copied into any HTML source file.
For our NasaImageBrowser application, the following files are generated:
NasaImageBrowser.jar
NasaImageBrowser.jar.pack.gz
NasaImageBrowser.html
NasaImageBrowser_browser.jnlp
NasaImageBrowser.jnlp
Upon opening the NasaImageBrowser.html page in a browser, the appropriate
JAR's files for the application and JavaFX will be downloaded and cached on the
user's machine. Then the application will run in the HTML page as shown in
Figure 9.2. One of the enhancements that the new applet framework provides is
this local caching mechanism. As long as the version for a JAR file does not
change, it does not need to be downloaded each time, thereby improving the
user's experience with quicker startup times. Also, if the user does not have the
correct version of Java installed on her machine, she is prompted to download
the correct Java JRE version.
Manual Generation to Support JavaFX Applets
If you are not using NetBeans IDE for Java, you will need to sign the JAR file
manually and create the JNLP deployment and HTML files by hand. Let's look
at the signing steps.
Signed JAR
To sign the JAR file, first you need to create a new public/private key pair stored
in a new keystore using the Java command keytool . For example, you may cre-
ate a keystore in the current directory, named myKeystore , with a store password
and a key password of password . The store password is the password that pro-
tects the integrity of the keystore. The key password protects the private key. The
alias myKey identifies this new entry in the keystore. The dname entry is the
X500 Distinguished Name and identifies the entity that is signing the applet.
 
Search WWH ::




Custom Search