[FrontPage] [TitleIndex] [WordIndex

How To Build Your Own Java WebStart Application

This page describes what steps are required to build a Java WebStart application (with or without deegree). For a more complete documentation, use google.

1. Get Yourself A Key

To obtain a key to later on sign the .jars, you need the keytool. It comes with the JDKs, so chances are you already have it in your path. Run it like this:

keytool -genkey -alias myalias -keyalg RSA -validity 365 -keystore keystore

You're then asked some questions which you can answer yourself.

2. Get Yourself An Application

Now you'll have to prepare the application. Get together all necessary .jars. Note that you can basically only deploy .jars, you cannot distribute other files unless you plan to use an installer!

3. Create a .jnlp

Use this template:

<?xml version="1.0"?>
<jnlp spec="1.0+" codebase="http://www.deegree.org/jnlp/" href="application.jnlp">
  <information>
    <title>Application</title>
    <vendor>lat/lon</vendor>
    <homepage href="http://www.deegree.org"/>
    <description>Application</description>
    <description kind="short">App</description>
    <offline-allowed/>
  </information>
  <security>
    <all-permissions/>
  </security>
  <resources>
    <j2se version="1.5" max-heap-size="512m"/>
    <jar href="application.jar" main="true"/>
    <jar href="anotherlibrary.jar"/>
  </resources>
  <application-desc main-class="org.deegree.Application"></application-desc>
</jnlp>

Edit the respective fields. The main-class attribute can be dropped, if the .jar with the main="true" attribute has a respective entry in the manifest. The codebase attribute must point to the location where all the .jars can be downloaded and where the .jnlp will be put as well. You can add as many .jars as you want, as long as there is one with the main attribute and they're all signed.

4. Sign All Unsigned Jars

Some .jars already come signed. You cannot sign these again, and if you have to use such a .jar, you'll have to use some tricks to get WebStart to be able to deploy the app. Please refer to the documentation to do so if you have signed .jars. The jarsigner will tell you about .jars which are already signed.

To sign a .jar, use the following call (substitute $file, $password and $JAVA_HOME with your favourite values):

$JAVA_HOME/bin/jarsigner -keystore keystore -storepass $password $file myalias

5. Upload The Application

Now all you've got to do is upload the files to the web server. Point people to the .jnlp and the application will start using that link.


CategoryDeegree2 CategoryHowTo


2018-04-20 12:04