Java Network Launch Protocol (JNLP)


Java Network Launch Protocol (JNLP)



A Java Web client uses the Java Network Launch Protocol (JNLP) to start the Java Web Start based client. A JNLP file that defines the security permissions along with the needed resources such as the jar files used by the client. 


1.1.1          Compress Client Resources

Once a user accesses the Tomcat server, the application asserts that the user's machine has the appropriate client JAR files.

During the initial startup of the application, the Java Plug-in (running on the user's machine) determines if the client resources need to be downloaded to the user's machine. The initial download time can be improved by compressing all needed client files. For example, compressing the a sample jar reduces the size from 2438 KB to 828 KB (approximately 30%). This would potentially reduce the total downloaded byte size from 10 MB to approximately 7 MB.



Optimizing the size of JAR files and related resources will allow the client to load quickly. The application JAR files can be compress using the pack200 tool (part of the Java JDK). Any unnecessary white space should also be removed from the generated Java Network Launch Protocol (JNLP) file. The time taken to download the various Jars depends on its size. Smaller JAR files are quicker to download.


Reduce the download time of client by applying the following techniques:



The following steps describe how to create and deploy a compressed JAR file.



Note that when the jnlp.packEnabled property is set in the JNLP file, the Java Plug-in software looks for the compressed JAR file with the .pack.gz extension. If the file with the .pack.gz extension is found by the Java Plug-in software, it automatically unpacks and loads the JAR file. If a file with the .pack.gz extension is not found, then the Java Plug-in software attempts to load the regular JAR file (for example, app-client.jar).





1.1.2          Use Java Web Start Version Download Protocol

Each time the client application is launched the Java Plug-in determines whether the user has the appropriate version of the client jar files. The JNLP based version download protocol can be used to eliminate unnecessary client Jar file checks.

In order to implement the version protocol, each client JAR file must include the version number with the following naming convention:


__V .jar


For example: app__V4.3.jar


The following XML element must also be added to the JNLP


The JnlpDownloadServlet is needed in order to support the Java Version Download protocol on Java clients older than 1.6. The Server jar files are included in the Java SDK download ${SDK_HOME}/sample/jnlp/servlet directory. It must be added to the web application. The jnlp-servlet.jar file must be added in the web application location;



In order to speedup the initial application client startup, enable the version download protocol.  With the jnlp.versionEnabled property, the Java Plug-in only performs one update check to make sure that the JNLP file is up-to-date. The Plug-in compares the version numbers that are specified in the JNLP file with the corresponding JAR file versions (according to the naming convention mentioned in step 1) and updates older JAR files. The load time improves because there is only one network update check is needed for the JNLP file verses each client jar. All other version checks occur locally. If a file with the correct version number is not found, the launch software attempts to load the default JAR file (for example, app-client.jar).


Example timing Note time format is "hh:mm:ss:ms"




Total Time

Without Versioning



18 seconds

With Versioning



7 seconds


These test results shows an 11 seconds response time improvement by using the versioning JNLP support.