Java Web Start Faq's - Techincal Questions

Do I need to change my application to work with Java Web Start?
If your application is written to the Java 2 platform, and is delivered as a set of

JAR files, there should be no need to revise your application. Make sure that your

application retrieves all its resources (such as images and resource bundles) from

a JAR file, since Java Web Start launches an application by invoking the public

static void main(String[] args) method.
If your application needs unrestricted access to the system, (for example,

network or disk access), you will need to sign your code.

Is there a migration path from applets to applications?
Java Web Start is primarily designed for application deployment. You specify all

requirements for your application in the JNLP file, and off you go. It does

provide the ability to launch applets in much the same way as the traditional

AppletViewer. The built-in AppletViewer provides an easy migration path for

existing applets that want to take advantage of Java Web Start. However, it is

not intended to be a full implementation of the Plug-In. The Plug-In is the primary

launching vehicle for applets. The built-in AppletViewer in Java Web Start has

limitations, for example, you cannot specify class files as resources and it does

not accept policy files.

Is there a way to pass VM arguments to the Java Runtime?
Java Web Start allows certain JVM flags to be set with the java-vm-args attribute

of the j2se element (see Developer's Guide). Allowing the complete set could

compromise security as well as limit portability across different platforms and

implementations. You can set the maximum and initial heap size using the initial

-heap-size and max-heap-size attributes of the j2se element, for example:

I don't want to rely on a server timestamp. How can I specify a versioned JAR

and how can I get incremental updates of JARs?
Java Web Start supports versioned JARs and incremental updates. You can

specify exact versions of the JAR files you want, instead of relying on timestamp

information to determine if an update is available. Using version IDs also allows

you to provide incremental updates from one version to another. See the JNLP

Specification or the
Developer's Guide for details.

Are JAR files shared between applications?
Each JAR file that a JNLP Client (such as Java Web Start) downloads, is uniquely

identified with a URL. If two JNLP files use the same URL, then the resource will

only be downloaded once and shared. This is similar to the caching

implementations used by web browsers.

How can I provide my own splash screen?
Java Web Start needs to put up the initial splash screen while Java is loading. For

subsequent access, you can specify an image file to use for the splash screen in

the JNLP file with the tag

where mysplash.jpg is the image file for your splash screen. The first time your

application runs, it will use the standard splash screen. After that, it will use the

image you provide.

How can I save the application state on the local system?
A sandboxed application can store state using the PersistenceService API. This

API is similar to cookies for HTML pages. Thus, it is a secure way to store

persistent information on the client computer. For more information, see:
 JNLP Specification
 Java Web Start Developers Guide

My application requires a specific version of the JRE. How do I specify this my

JNLP file?
The tag specifies a platform version, where versionNum is 1.2, 1.3, 1.4, or 1.5.
You can request a specific product version by including a vendor URL in the href

attribute. For Sun's JREs, the URL is

For example, the following J2SE tag will request any Sun 1.3.1 implementation:

You can see all the versions of the installed JREs in the Java tab of the Java

Control Panel.

Can I rely on Class-Path in the manifest file?
Java Web Start does not support the Class-Path entry in the manifest file. The

Class-Path attribute is entirely file-centric, whereas Java Web Start and JNLP is

web-centric, i.e., based on URLs. Thus, the two models do not merge easily.
Instead of relying on the Class-Path entry, you can list multiple JAR files in the

JNLP file, for example:

In a JNLP file, you can factor out dependencies on a set of JAR files to another

JNLP file using the element. Thus, you can achieve the same kind of re-usability

and ease of maintenance as you do with the Class-Path entry. This feature is

described in the specification.
JNLP also implements a just-in-time downloading mechanism, similar to applets.

For each resource in a JNLP file, you can specify which parts should be eagerly

or lazily downloaded. Eagerly loaded resources are loaded before the application

is launched, lazily loaded resources later. Default is eager download.

Furthermore, the specification includes an API for which you can programatically

query Java Web Start about which resources are available and request them to be

downloaded. Thus, you can write download/network aware applications.
See the JNLP specification for more information.

Can I use Java Web Start even if my application depends on or uses native code?
You can use Java Web Start to deploy Java Technology-based applications that

depend on native code such as DLLs and SOs. Use the element to specify required

native libraries. See the Developer's Guide for details.

How can I load resources within my application using Class.forName and

Java Web Start uses a user-level classloader to load all the application resources

specified in the JNLP file.

This classloader implements the security model and the downloading model

defined by the JNLP specification. This is no different than how the AppletViewer

or the Java Plug-In works.
This has the, unfortunate, side-effect that Class.forName will not find any

resources that are defined in the JNLP file. The same is true for looking up

resources and classes using the system class loader

To find application resources in Java Web Start, use the classloader that loaded

your application, for example use the following call in the in the application;s

main thread:
You can also use:

How can I launch Java Web Start from the command line?
You can launch Java Web Start from the command line as follows:
javaws [options] your-app-JNLP-URL
where your-app-JNLP-URL is the location of your application's JNLP file. For

For complete command line syntax see: the Developer's Guide

How do I use multiple JAR files signed by different certificates?
The JNLP 1.0 specification requires all JAR files used in a JNLP file to be signed

by the same certificate. This restriction avoids requiring the user to accept

multiple certificates from the same source, and enables Java Web Start to know

if the user has accepted all certificates used for an application.
However, Java Web Start can use multiple JAR files signed by different

certificates, by using the component extension mechanism and multiple JNLP

files. The only requirement is that the JAR files contain code from different

packages. So, instead of the following:

No comments: