Deploying eclipse based application with Java Web Start

Applications built on Eclipse can be deployed using Java Web Start.

Java Web Start "is an application-deployment technology that gives you the power to launch full-featured applications with a single click from your web browser".

The prerequisites to start eclipse from Java Web Start are:

The following steps describe how to setup a Java Web Start site serving up a feature based RCP application. These steps are for applications based on eclipse 3.3. Instructions on how to achieve the same for eclipse 3.1 and 3.2 can respectively be found in the 3.1 and 3.2 SDKs.

Step 1, creating a wrapper feature

Step 2, exporting the wrapper feature

Note. Before proceeding with this step make sure to have a key store available. Eclipse does not provide any facility to create key stores. You can use the keytool application that comes with the JDK. In addition, ensure that the eclipse you are developing with is running on a Java SDK instead of a JRE. If this constraint is not satisfied, the jar signing will fail.

Step 3, creating the main JNLP file

A Java Web Start application is described by JNLP files. They replace the eclipse.exe and the config.ini files by some equivalent mechanism. For example, JNLP has its own mechanism to control splash screen, ways to pass parameters and define what constitutes the application.

When you did the export, all the simple JNLP files have been created, so you are left with writing the main file that will control the application. Because the majority of the main file is common to all applications, it is recommended to start from the following self documented template.

On the site serving up your application, the file must be located at the root. Once you will be done editing this file, your application will be ready.

<?xml version="1.0" encoding="UTF-8"?>
<jnlp 
    spec="1.0+" 
    codebase="http://myCompany.org/jnlpServer" 
    href="mail.jnlp"> <!-- URL to the site containing the jnlp application. It should match the value used on  export. Href, the name of this file -->
  <information>
    <!-- user readable name of the application -->
    <title> Mail Application </title>  
    <!-- vendor name -->
    <vendor>My company</vendor>
    <!-- vendor homepage --> 
    <homepage href="My company website" /> 
    <!-- product description -->
    <description>This is a mail client</description> 
    <icon kind="splash" href="splash.gif"/>
  </information>
 
  <!--request all permissions from the application. This does not change-->
  <security>
    <all-permissions/>
  </security>
 
  <!-- The name of the main class to execute. This does not change-->
  <application-desc main-class="org.eclipse.equinox.launcher.WebStartMain">
    <argument>-nosplash</argument>
  </application-desc>
 
  <resources>
    <!-- Reference to the launcher jar. The version segment must be updated to the version being used-->
    <jar href="plugins/org.eclipse.equinox.launcher_<version>.jar"/>
 
    <!-- Reference to all the plugins and features constituting the application -->
    <!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins  necessary -->
    <extension 
        name="Wrapper feature"
        href="features/Wrappering_1.0.0.jnlp"/>
 
    <!-- Information usually specified in the config.ini -->
    <property 
        name="osgi.instance.area" 
        value="@user.home/Application Data/mail"/>
    <property 
        name="osgi.configuration.area" 
        value="@user.home/Application Data/mail"/>
        
    <!-- The id of the product to run, like found in the overview page of the product editor -->
    <property 
        name="eclipse.product" 
        value="mail.product"/>
  </resources>

  <!-- Indicate on a platform basis which JRE to use --> 
  <resources os="Mac">
    <j2se version="1.5+" java-vm-args="-XstartOnFirstThread"/>
  </resources>
  <resources os="Windows">
    <j2se version="1.4+"/>
  </resources>
  <resources os="Linux">
    <j2se version="1.4+"/>
  </resources>
</jnlp>

Tip: once you have created this file, you can store it in the wrapper feature in a folder such that on every export you will get the complete structure. This folder needs to be referenced from the root property of the build.properties (e.g: root=<folderContainingMainJNLPFile>/).

Plug-ins based application

Even though your RCP application does not use features, Java Web Start-ing it is possible.

To do so, it is recommended to create a wrapper feature in order to facilitate the creation of the main jnlp file and ease the deployment. This wrapper feature will list all the plug-ins of your application. Once the feature has been updated copy the generated JNLP file and modify it to become your main JNLP file.

Miscellaneous

Java Web Start on linux

When an eclipse application is started with Web Start on Linux the default windowing system is motif. If you want to run GTK, you need to set the property osgi.ws to "gtk" in the main jnlp file. For example you can add:

  <resources os="Linux">
        <property name="osgi.ws" value="gtk"/>
  </resources>

Known limitations