Trail: Deployment
Lesson: Java Web Start
Developing Java Web Start Applications
Home Page > Deployment > Java Web Start
Developing Java Web Start Applications
For the most part, you develop applications to be deployed through Java Web Start just as you would develop stand-alone Java applications. However, there are some packaging considerations, which are described in the following sections:

Packaging the Application in JAR Files

To deploy an application with Java Web Start, you must package the application as one or more JAR files. In particular, you must package the application's files into one or more JAR files.

Note : Other resources such as images and property files can, if necessary, be outside of JAR files and retrieved using HTTP requests. However, storing resources in JAR files is preferred, because JAR files are cached on the local computer by Java Web Start.
If the application needs unrestricted access to the local system, all JAR files and entries must be signed. For more information, see the
Java Web Start and Security section.

Reading Resources in a JAR File

Use the getResource method to read resources from a JAR file. For example, the following code example retrieves images from a JAR file:
// Get current classloader
ClassLoader cl = this.getClass().getClassLoader();
// Create icons
Icon saveIcon  = new ImageIcon(cl.getResource("images/save.gif"));
Icon cutIcon   = new ImageIcon(cl.getResource("images/cut.gif"));
The example assumes that the following entries exist in the JAR files for the application:
  • images/save.gif
  • images/cut.gif

Untrusted Applications

Unless you sign your application's JAR files, which requires users to accept your certificate, your application deployed through Java Web Start is untrusted. Untrusted applications have the following restrictions:
  • The application can not access the local disk.
  • All JAR files for the application must be downloaded from the same server.
  • The application can only make network connections to the server from which the JAR files were downloaded.
  • A security manager can not be removed or replaced.
  • The application cannot use native libraries.
  • The application has limited access to system properties. The application has read/write access to a set of system properties known to be secure, and read-only access to the same set of properties as an applet.

For more information, see the Java Web Start and Security section.

Also see The JNLP API section for information on using the special Java Web Start packages in your applications.

Previous page: Deploying Java Web Start Applications
Next page: The JNLP API