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:
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.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.
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.
Use thegetResource
method to read resources from a JAR file. For example, the following code example retrieves images from a JAR file:The example assumes that the following entries exist in the JAR files for the application:// 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"));
- images/save.gif
- images/cut.gif
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.