ANT Task to Create a JNLP Deployment Descriptor

Description

This task creates a JNLP (Java Web Start) deployment descriptor (xml file with extension .jnlp)

JNLP is probably the best method to deploy applications onto a wide range of computers with various architectures.

How to use

Installation

One of the easiest way is simple copy the jar jugbbant-*.jar into the ANT runtime lib directory

The disadvantage of this method is, you collect a lot of different libs (over the time) into your ANT runtime and if you decided to change your ANT version you have to move all of them. The next problem is, especially in larger projects, all of the involved developer have to do that.

A fare better approach is to store the jugbbant-*.jar file into your project and reference it from your build script.

Task attributes

Class: org.jugbb.ant.jws.JNLPTask

The jnlp task has these attributes:

Attribute Description Required
title Title of deployed application Yes
vendor Vendor of the deployed application Yes
description A short descriptive text No
folderwithsignedjars Path to the folder containing the signed jar files. Typically it is an ant property. Yes
iconhref Name of the icon file which will be used as application icon on the desktop environment No
codebase Base URL to the resources (jars, jnlp file, icons) Yes
createdesktopshortcut true = Creates a desktop shortcut to your with Java Web Start deployed application No
createmenuentry true = Creates a menu entry for your with Java Web Start deployed application No
javaversion Required Java runtime version. Example: 1.6+ means Java 6 and higher. Yes
javamaxheapsize The maximum heap space what the Java runtime should provide for your application. Example: 512m = 512MByte RAM No
mainJarFile Jar file containing the main method No
associatewithfileextensions What kind of files (depends on the file extension) your application belongs to. No
associatewithmimetype What mime type your application belongs to. No
jnlpfilename The name of the JNLP deployment descriptor file. This file will be created by this task. Yes
mainclass Class (including package) containing the main method. Yes
offlineallowed true = Your application works even the computer has no network connection. Yes
jnlpversion Version of the JNLP protocoll. Default=6.0+. Many of the features of JNLP are only available in equal/greater version 6.0. No

Example

This examples shows a typical usage.

The necessary lib for this (and other) task is located within the current project (example: build/).

<taskdef name="jnlp" classname="org.jugbb.ant.jws.JNLPTask" classpath="build/jugbbant-1.7.jar"/>
<jnlp 
    title="SQLRunner" 
    vendor="Java User Group Berlin-Brandenburg / Jan Lolling"
    description="Database client to manipulate database directly with SQL with input and export capabilities"
    folderwithsignedjars="${javawebstart}"
    iconhref="sqlrunner.gif"
    codebase="http://web.me.com/jlolling/Home/sqlrunner/jws/"
    createdesktopshortcut="true"
    createmenuentry="true"
    javaversion="1.6+"
    javamaxheapsize="1024m"
    associatewithfileextensions="sql"
    associatewithmimetype="text/x-sql"
    jnlpfilename="sqlrunner.jnlp"
    mainclass="${mainclass}"
    offlineallowed="true"
    jnlpversion="6.0+"/>
		

Download

Binary: jugbbant-1.7.jar

Sources: jugbbant-1.7-src.zip