Creating a Java Web Start JNLP Definition for Java Clients

You use the Java Web Start Wizard to create the XML-based JNLP (Java Network Launching Protocol) definition file that the Java Web Start software uses to download and run Java applications and applets on client machines.

Note: You must download and install the Java Web Start software from the http://java.sun.com/products/javawebstart/ web site to launch applications and applets with Java Web Start in JDeveloper. Users of your application or applet will also be required to install the software on their machines.

The application or applet must be delivered in a set of JAR files and all application resources, such as images, configuration files and Native libraries, must be included in the JAR files. The resources must be looked up using the ClassLoader getResource or another method. Java Web Start only transfers JAR files from the Web server to the client. Please refer to the Java Web Start documentation available from Sun Microsystems (use the link above) for additional information.

The wizard adds a JNLP file and (optionally) an HTML file to your project. Java Web Start will use these generated files to determine what application source to download from the web server:

Before you launch the Java Web Start Wizard to create the JNLP and HTML files, you must create a simple archive (JAR) file for it. You must also know in which class the main function can be found, as you will be asked to specify this.

To create the JNLP definition for your application or applet:

  1. In the Navigator, select the project in which you want to generate a JNLP definition.
  2. Choose File then choose New to open the New Gallery.
  3. In the Categories tree, expand Client Tier and select Swing/AWT.
  4. In the Items list, double-click Java Web Start (JNLP) Files to open the Java Web Start wizard.
  5. Click Next in the Welcome page.
  6. In the Application Information page, enter the file name, the name and location of the jar file that you created, and the class that you want to use to run your application.

    For detailed help in using the Java Web Start wizard, press F1 or click Help from within the wizard.

  7. Check Create Homepage to create the optional HTML file. Click Next after specifying the desired options.
  8. In the Web Start page, specify information to document the JNLP file.
  9. Complete the wizard and click Finish .

You can also use a JSP file or servlet with Java Web Start, however, you will have to manually configure the file and change the content type. Here is an example JNLP with contentType = application/x-java-jnlp-file, specified in the first line:

<%@ page contentType="application/x-java-jnlp-file" %>
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://192.168.1.102:8888" href="jnlpfile.jnlp">
<information>
<title>Test</title>
<vendor>Oracle</vendor>
<homepage href="Test.html"/>
<description>Encryption Tool</description>
<icon href="images/frontpage.gif"/>
<offline-allowed/>
</information>
<security><all-permissions/></security>
<resources>
<j2se version="1.3"/>
<jar href="/apps/archive1.jar" main="true" download="eager" />
</resources>
<application-desc main-class="oracle.Ide">
</application-desc>
</jnlp>


About Java Web Start and Java Clients
Running Applications and Applets with Java Web Start in JDeveloper
Deploying a Java Client Web Application Archive for Java Web Start