Java Web Start - Runtime Versioning

Java Web Start can be used to ensure that an application gains a certain minimum version of the JRE (Java Runtime Environment) that it requires to run. Web start can also be used to ensure a specific micro-version of the JRE is available to an application, or that an earlier major release is used (e.g. using 1.3, on a system where 1.6 is installed).

Unless the system is correctly configured, the user might be prompted for download.

Minimum Version

Java web start can be used to ensure a Java project is launched with a particular minimum version of Java. For example, if the application uses generics, but nothing beyond what is available in Java 1.5, the JNLP deployment descriptor might include a section that says..

..
<resources>
	<j2se version='1.5+'>
	...
</resources>

Micro Version

Besides being able to specify a minimum Java Major version, the deployer can also mandate a particular micro-version. An example of where this can be handy, might be seen in changes to JRE's based on new information about Daylight Savings Time (which can be changed by regional governments at any time they see the need to change them).

..
<resources>
	<j2se version='1.5.0_11'>
	...
</resources>

Earlier Version

Web start has a handy feature in that it can allow us to test applications against specific earlier Java versions. For example, if the local build environment is based around 1.6, but an application is supposedly 1.5+, it pays to test the final product in a 1.5 JRE prior to deployment. Invoking a 1.5 JRE in the 1.6 environment can be as simple as.

..
<resources>
	<j2se version='1.5'>
	...
</resources>

Note the difference to the first example, which used '1.5+', whereas this one uses '1.5' - to indicate that only a 1.5 JRE will do.

An alternative version..

..
<resources>
	<j2se version='1.5*'>
	...
</resources>

Prompt for Download

A problem commonly reported by people deploying applications via web start, is that they are being prompted to download versions of Java that are already locally installed.

Even if a specific Java version is installed, it might not be flagged as being 'available' for use by web start. This can be easily fixed.

Open the Java Control Panel.

Select the Java tab and click the View button of Java Application Runtime Settings. You might see something like this.

Note which ones are Enabled (right column). This PC is set up to use 1.6.0, 1.5.0_11, or 1.5.0_08. Neither of the 1.5.0-beta or 1.5.0_01 micro versions is available. That is purely by my choice - if I needed to test against these very early 1.5 versions, I could simply enable them as needed.

Ensure any versions of interest are Enabled and the problem should be fixed. Web start will be able to load that version of the JRE and use it, without any prompt for download.

If you have versions installed that do not appear in the User list, click Find to launch the JRE Finder to search for them. The (Java 1.6) JRE Finder will present a dialog with a message along these lines.

In order to launch applications, Java Web Start needs to know the locations of installed Java Runtime Environments.

You can either select a known JRE, or select a directory in the file system from which to search for JREs.

A thread on the web start forum also produced the following comments from Andy Herrick.

On Windows, the list of available JRE's is populated from the registry which contains pointers to all the publicly installed JRE's. (It will not automatically include private JRE's, such as those installed by a JDK install, where "install public JRE" is not selected.).

On unix it will only, by default, contain the JRE it came with and any installed by java web start or that came with any previous version of java web start that had previously been run.

He adds a further note on specifying a download source..

Using either:

<j2se version="1.5*" href="http://java.sun.com/products/autodl/j2se"/>
or
<j2se version="1.5" />
will get you any 1.5 version available on the system.

If you use the href attribute, you are asking for the particular update release, so..

<j2se version="1.5" href="http://java.sun.com/products/autodl/j2se"/>
..will only work with 1.5.0_00.
© 2003-2011 by Andrew Thompson. All rights reserved.
Web hosting compliments of Java Web Hosting.
Java Web Hosting