Changing Java Webstart Settings: Opening JNLP files with a specific JRE

Friday, November 28, 2008

JNLP (Java Network Launching Protocol) files launched from browser are used to execute Java Webstart applications, the difference between Java Webstart applications and Java applets are Java Webstart applications don't run inside the browser (consider them as a Java application launched through browser which runs on the client machine but not in the browser context), whereas a java applet runs in an web browser context, they are executed in a sandbox with security restrictions and they may not access local data.

Java Webstart applications are lauched by javaws (can be found in JAVA_HOME/bin/javaws).

Java Webstart applications can be used when a software application needs to be run on the client system without browser dependency (which applets require), as obvious Java Webstart applications are platform independent software and can be launched from any platform with the supported JRE for the application (say Java 1.4 or 1.5).

Often we may need to launch a Java Webstart application on a specific JRE, this may be done by changing Java Webstart settings by selectively enabling the specific JRE as default or by specifying the javaws path upon prompted before opening the Java Webstart application, we will specifically see how to run a single java webstart application with two different JREs (JRE Version 1.5 and 1.6).

The sample web application used is a java swing text validation utility which can be found here, use this application to try out both the approaches.

Selectively Enabling Java Application runtime settings:

1. Launch Java Webstart settings (All Programs -> Control Panel -> Java)

2. Click on Java tab -> View button on Java Application Runtime Settings

3. One can see the all the JRE versions installed in that machine, by default all of them would be enabled, see the below figure.

Figure 1: JNLP Runtime settings showing installed JRE versions

4. To enable only a specific JRE to be used to launch applications by default, enable only that specific JRE, for example from the above figure, to select only Java 1.6 runtime to launch your Webstart applications, uncheck Java 1.5 option (see the above figure), click OK, click Apply from the Java Application Runtime Settings section, then restart the browser.

Choosing a specific JRE version for Java Webstart applications on the fly by specifying the javaws path:

One can also specify the path for javaws on the specific JRE installation location to be used to execute Java webstart applications. Before doing this, one needs to enable the prompt user option through the Java Runtime settings before executing a Webstart application .

1. Launch Java Webstart settings (All Programs -> Control Panel -> Java)

2. Click Advanced tab

3. Expand JNLP File/MIME Association, select the Prompt User option, click Apply, restart the browser (see below).

Figure 2: Changing JNLP/MIME Association settings

4. Now whenever you open a JNLP file, you will be prompted with options to open the application either with the default settings or choosing the JRE location (javaws,) if the location of javaws is selected, then that JRE will be used (see the below figure).

Figure 3: Specifying the JRE location (javaws) to open a Java Webstart Application


Anil Philip said...
This comment has been removed by the author.
Anil Philip said...

where is the jnlp file stored on the local desktop?
Appreciate your reply...

Prasanna Seshadri said...


I think it will probably stored in temporary directory in Windows (C:/Documents and Settings/<login-username>/Local Settings/Temp) or /var/tmp in Unix.

Chintan said...

really its very helpful to me...

Copyright © 2016 Prasanna Seshadri,, All Rights Reserved.
No part of the content or this site may be reproduced without prior written permission of the author.