The Oracle Java Tutorials summarize Web Start as follows:
Java Web Start software provides the power to launch full-featured applications with a single click. Users can download and launch applications, such as a complete spreadsheet program or an Internet chat client, without going through lengthy installation procedures.
Other advantages of Java Web Start are support for signed code and explicit declaration of platform dependencies, and support for code caching and deployment of application updates.
Java Web Start is also referred to as JavaWS and JAWS. The primary sources of information are:
javax.jnlp
API DocumentationAt a high level, Web Start works by distributing Java applications packed as JAR files from a remote webserver. The prerequisites are:
A pre-existing Java installation (JRE or JDK) on the target machine where the application is to run. Java 1.2.2 or higher is required:
The webserver that hosts the software must be accessible to the target machine.
If the user is going to launch a Web Start application using a link in a web page, then:
The following example is intended to illustrate the basic functionality of JNLP.
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="https://www.example.com/demo"
href="demo_webstart.jnlp">
<information>
<title>Demo</title>
<vendor>The Example.com Team</vendor>
</information>
<resources>
<!-- Application Resources -->
<j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Demo.jar" main="true"/>
</resources>
<application-desc
name="Demo Application"
main-class="com.example.jwsdemo.Main"
width="300"
height="300">
</application-desc>
<update check="background"/>
</jnlp>
As you can see, a JNLP file XML-based, and the information is all contained in the <jnlp>
element.
spec
attribute gives the version of the JNPL spec that this file conforms to.codebase
attribute gives the base URL for resolving relative href
URLs in the rest of the file.href
attribute gives the definitive URL for this JNLP file.<information>
element contains metadata the application including its title, authors, description and help website.<resources>
element describes the dependencies for the application including the required Java version, OS platform and JAR files.<application-desc>
(or <applet-desc>
) element provides information needed to launch the application.The webserver must be configured to use application/x-java-jnlp-file
as the MIMEtype for .jnlp
files.
The JNLP file and the application's JAR files must be installed on the webserver so that they are available using the URLs indicated by the JNLP file.
If the application is to be launched via a web link, the page that contains the link must be created on the webserver.
If you can assume that Java Web Start is already installed on the user's machine, then the web page simply needs to contain a link for launching the application. For example.
<a href="https://www.example.com/demo_webstart.jnlp">Launch the application</a>
Otherwise, the page should also include some scripting to detect the kind of browser the user is using and request to download and install the required version of Java.
NOTE: It is a bad idea to encourage users to encourage to install Java this way, or even to enable Java in their web browsers so that JNLP web page launch will work.
The instructions for launching an Web Start application from the command line are simple. Assuming that the user has a Java 5.0 JRE or JDK installed, the simply need to run this:
$ javaws <url>
where <url>
is the URL for the JNLP file on the remote server.