Using Java Web Start to launch SimplyHTML

Java Web Start - a technology for simplifying deployment of Java applications - gives users the power to launch full-featured applications with a single click from a Web browser. Introduced in version 1.4 of the Java 2 Standard Edition (J2SE) Java Web Start allows to download and launch applications, such as SimplyHTML, without going through complicated installation procedures.

Benefits

The following benefits as listed in the Java Network Launching Protocol (JNLP) specification result from using Java Web Start:

- No installation phase: A JNLP Client simply needs to download and cache the application’s resources. The user does not need to be prompted about install directories and the like.
- Transparent update: A JNLP Client can check the currently cached resources against the versions hosted on the Web Server and transparently download newer versions.
- Incremental update: The JNLP Client only needs to download the resources that have been changed when an application is updated. If only a few of the application’s resources have been modified, this can significantly reduce the amount of data that needs to be downloaded when upgrading to a new version of an application. Furthermore, incremental update of individual JAR files is also supported.
- Incremental download: A JNLP Client does not need to download an entire application before it is launched. For example, for a spreadsheet application the downloading of the graphing module could be postponed until first use. JNLP supports this model by allowing the developer to specify what resources are needed before an application is launched (eager), and what resources can be downloaded later (lazy). Furthermore, JNLP provides an API so the developer can check if a resource is local or not (e.g., need to be downloaded or not), and to request non-local resources to be downloaded.
- Offline support: A JNLP Client can launch an application offline if a sufficient set of resources are cached locally. However, most applications deployed using JNLP are expected to be Web-centric, i.e., they will typically connect back to a Web server or database to retrieve their state. Hence, many applications will only work online. The application developer specifies if offline operation is supported, and what resources are needed locally to launch the application offline.

How Java Web Start works for SimplyHTML

With stage 8 of SimplyHTML, the application home page at http://www.lightdev.com/dev/sh.htm holds a link to a .jnlp file which in turn specifies all details of application SimplyHTML (required files, descriptions, etc.). When the link is clicked, Java Web Start is invoked on the client and the application is loaded down to the client. Once loaded, SimplyHTML is launched and the application can be used immediately.

No manual installation, no copying of files, no command line scripting or desktop links, no compatibility checking, nothing.

Users can choose to always start SimplyHTML through the web or to download it to the client permanently and work with the application offline.

How it is done

To achieve a Java Web Start for SimplyHTML a .jnlp file is created as follows (with codebase below having an example entry)

<?xml version="1.0" encoding="UTF-8"?>

<jnlp spec="1.0+" codebase="http://www.lightdev.com/dev/">

<information>

<title>SimplyHTML</title>

<vendor>Light Development</vendor>

<homepage href="http://www.lightdev.com/dev/sh.htm" />

<description>SimplyHTML text processor for HTML and CSS</description>

<offline-allowed/>

</information>

<security>

<all-permissions/>

</security>

<resources>

<j2se version="1.4+" />

<jar href="SimplyHTML.jar"/>

<extension name="Java Help" href="javahelp.jnlp">

</extension>

</resources>

<application-desc main-class="com.lightdev.app.shtm.App" />

</jnlp>

A similar .jnlp file is created to deploy the JavaHelp runtime extension (file jhall.jar). The .jnlp files are copied onto the web server along with the signed application .jar file. Once the application home page has the mentioned link to the .jnlp file, it is ready to be 'Web Started'.

References

A very good article about how to 'Web Start' an application can be found at

http://developer.java.sun.com/developer/technicalArticles/Programming/jnlp/

A perfect explanation of how to obtain a certificate from a Certificate Authority and how to sign own code with such certificate can be found at

http://www.dallaway.com/acad/webstart/

The official Java Web Start product page is at

http://java.sun.com/products/javawebstart/