Java Web Start (JWS) allows the user to launch his Java applications with a single click from your Web browser. From J2SE version 1.4,onwards JWS has been included with the JRE and so doesn’t need to be installed separately and JWS is based on the Java Network Launch Protocol(JNLP).
JNLP is an XML-based protocol that helps to launch executable java files over the Web. Normal java application always relay on local file system for their resources, JNLP helps you to specify the resources of your application (JAR files, files etc), that may scattered over the web by giving their URLs.
The JNLP protocol defines different parameters for a Java application, like the location of the jars, resources etc. JNLP can be considered as an alternative to an applet based application, as it offers some of the same functionality,launching an application from a URL, caching parameters etc.
This feature gives application the ability of deploying automatically just by referring where you can find the files(resources) on the Web.
<?xml version=”1.0″ encoding=”utf-8″?/>
<jnlp codebase=”url href=”jnlpfile.jnlp” >
<information >
<title>title</title >
<vendor>vendor</vendor >
<description>desc</description>
<offline-allowed>true/false</offline-allowed>
</information>
<resources>
<j2se version=”1.3″/>
<jar href=”jarfile.jar”/>
</resources>
application-desc main-class=”mainclass”/>
</jnlp>
<jnlp codebase=”url href=”jnlpfile.jnlp” >
<information >
<title>title</title >
<vendor>vendor</vendor >
<description>desc</description>
<offline-allowed>true/false</offline-allowed>
</information>
<resources>
<j2se version=”1.3″/>
<jar href=”jarfile.jar”/>
</resources>
application-desc main-class=”mainclass”/>
</jnlp>
How does it works?
The JNLP is working in a client-server model ,the JNLP client reads the xml(JNLP) file which eventually loads the resources .
Step 1
Build your application and package it with jar utility.
Step 2
Sign your jar file,so that the client can verify the origin. If you do not have a certificate ,there are utilities in JDK to create your own certificate.
e.g
keytool -genkey -keystore yourKeystore -alias YourName
(you have to fill keystore password, first name, last name , etc)
Sign the jar:
jarsigner -keystore yourKeystore jarfile.jar YourName
Finally copy jar to default web server folder.
Step 3
Create JNLP file and copy to default web server folder
Step 4
Start Web server and access the URL which has JNLP link
The JNLP provides a rich running environment for the applications. This allow the applications to use standard resources at run time.
Advantages
Disadvantages
Java Web Start which is very secure and easy to use , is one of the powerful technologies that deliver applications a rich interface and features of standard desktop applications