Structure of the JNLP File

This topic describes the syntax of the Java Network Launch Protocol (JNLP) file for rich Internet applications (RIAs).

The following code snippet shows a sample JNLP file for a Java Web Start application:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
    <information>
        <title>Dynamic Tree Demo</title>
        <vendor>Dynamic Team</vendor>
        <icon href="sometree-icon.jpg"/>
        <offline-allowed/>
    </information>
    <resources>
        <!-- Application Resources -->
        <j2se version="1.6+" href=
           "http://java.sun.com/products/autodl/j2se"/>
        <jar href="DynamicTreeDemo.jar"
            main="true" />

    </resources>
    <application-desc
         name="Dynamic Tree Demo Application"
         main-class="webstartComponentArch.DynamicTreeApplication"
         width="300"
         height="300">
     </application-desc>
     <update check="background"/>
</jnlp>

The following table describes the elements and attributes commonly used in JNLP files. Click the parent link to view an element's parent.

Note:

This table does not include all possible contents of the JNLP file. For more information, see the Java Network Launching Protocol and API Specification Change Log.

Commonly Used Elements and Attributes in a JNLP file

ElementAttributesDescriptionSinceRequired
jnlpThe topmost xml element for a JNLP file.1.0Yes
specValue of the attribute can be 1.0, 1.5, or 6.0, or can use wildcards such as 1.0+. It denotes the minimum version of the JNLP Specification that this JNLP file can work with.1.0
codebaseThe base location for all relative URLs specified in href attributes in the JNLP file.1.0
hrefThe URL of the JNLP file itself.1.0
versionThe version of the RIA being launched, as well as the version of the JNLP file itself.1.0
information parentContains other elements that describe the RIA and its source.1.0Yes
osThe operating system for which this information element should be considered.1.5.0
archThe architecture for which this information element should be considered.1.5.0
platformThe platform for which this information element should be considered.1.5.0
localeThe locale for which this information element should be considered.1.5.0
title parentThe title of the RIA.1.0Yes
vendor parentThe provider of the RIA.1.0Yes
homepage parentThe homepage of the RIA.1.0
hrefA URL pointing to where more information about this RIA can be found.1.0Yes
description parentA short statement describing the RIA.1.0
kindAn indicator as to the type of description. Legal values are one-line, short, and tooltip.1.0
icon parentAn icon that can be used to identify the RIA to the user.1.0
hrefA URL pointing to the icon file. Can be in one of the following formats: gif, jpg, png, ico.1.0Yes
kindIndicates the suggested use of the icon, can be: default, selected, disabled, rollover, splash, or shortcut.1.0
widthCan be used to indicate the resolution of the image.1.0
heightCan be used to indicate the resolution of the image.1.0
depthCan be used to indicate the resolution of the image.1.0
offline-allowed parentIndicates that this RIA can operate when the client system is disconnected from the network.1.0
shortcut parentCan be used to indicate the RIA's preferences for desktop integration.1.5.0
onlineCan be used to describe the RIA's preference for creating a shortcut to run online or offline.1.5.0
desktop parentCan be used to indicate the RIA's preference for putting a shortcut on the user's desktop.1.5.0
menu parentCan be used to indicate the RIA's preference for putting a menu item in the user's start menus.1.5.0
sub-menuCan be used to indicate the RIA's preference for where to place the menu item.1.5.0
association parentCan be used to hint to the JNLP client that the RIA wants to be registered with the operating system as the primary handler of certain extensions and a certain mime-type. If this element is included, either the offline-allowed element must also be included, or the href attribute must be set for the jnlp element.1.5.0
extensionsA list of file extensions (separated by spaces) that the RIA requests it be registered to handle.1.5.0
mime-typeThe mime-type that the RIA requests it be registered to handle.1.5.0
related-content parentAn additional piece of related content that can be integrated with the RIA.1.5.0
hrefA URL pointing to the related content.1.5.0Yes
update parentThe preferences for how RIA updates should be handled by the JNLP client.1.6.0
checkThe preference for when the JNLP client should check for updates. Value can be always, timeout, or background..1.6.0
policyThe preference for how the JNLP client should handle a RIA update when a new version is available before the RIA is launched. Values can be always, prompt-update, or prompt-run.1.6.0
1.0
security parentCan be used to request enhanced permissions. If this element is not included, the application is run in the security sandbox.1.0
all-permissions parentRequests that the RIA be run with all permissions.1.0
j2ee-application-client-permissions parentRequests that the RIA be run with a permission set that meets the security specifications of the J2EE application client environment.1.0
resources parentDescribes all the resources that are needed for the RIA.1.0Yes
osThe operating system for which the resources element should be considered.1.0
archThe architecture for which the resources element should be considered.1.0
localeThe locales for which the resources element should be considered.
java or j2se parentVersions of Java software to run the RIA with.1.6.0 (java)
versionOrdered list of version ranges to use.1.0Yes
hrefThe URL denoting the supplier of this version of Java software, and from where it can be downloaded.1.0
java-vm-argsAn additional set of standard and non-standard virtual machine arguments that the RIA would prefer the JNLP client use when launching the JRE software.1.0
initial-heap-sizeThe initial size of the Java heap.1.0
max-heap-sizeThe maximum size of the Java heap.1.0
jar parentA JAR file that is part of the RIA's classpath.1.0Yes
hrefThe URL of the JAR file.1.0Yes
versionThe requested version of the JAR file. Requires using the version-based download protocol1.0
mainIndicates if this JAR file contains the class containing the main method of the RIA.1.0
downloadIndicates that this JAR file can be downloaded lazily, or when needed.1.0
sizeThe downloadable size of the JAR file in bytes.1.0
partCan be used to group resources together so that they are downloaded at the same time.1.0
nativelib parentA JAR file that contains native libraries in its root directory.1.0
hrefThe URL of the JAR file.1.0Yes
versionThe requested version of the JAR file. Requires using the version-based download protocol1.0
downloadCan be used to indicate this JAR file can be downloaded lazily.1.0
sizeThe downloadable size of the JAR file in bytes.1.0
partCan be used to group resources together so they will be downloaded at the same time.1.0
extension parentA pointer to an additional component-desc or installer-desc to be used with this RIA.1.0
hrefThe URL to the additional extension JNLP file.1.0Yes
versionThe version of the additional extension JNLP file.1.0
nameThe name of the additional extension JNLP file1.0
ext-download parentCan be used in an extension element to denote the parts contained in a component-extension.1.0
ext-partThe name of a part that can be expected to be found in the extension.1.0Yes
downloadCan be used to indicate this extension can be downloaded eagerly or lazily.1.0
partDenotes the name of a part in this JNLP file in which to include the extension.1.0
package parentCan be used to indicate to the JNLP client which packages are implemented in which JAR files.1.0
namePackage name contained in the JAR files of the given part.1.0Yes
partPart name containing the JAR files that include the given package name.1.0Yes
recursiveCan be used to indicate that all package names, beginning with the given name, can be found in the given part.1.0
property parentDefines a system property that will be available through the System.getProperty and System.getProperties methods.1.0
nameName of the system property.1.0Yes
valueValue of the system property.1.0Yes
Note: A JNLP file must contain one of the following: application-desc, applet-desc, component-desc, or installer-desc.1.0Yes
application-desc parentDenotes this is the JNLP file for an application.1.0
main-classThe name of the class containing the public static void main(String[]) method of the application.1.0Yes
argument parentEach argument contains (in order) an additional argument to be passed to the main method.1.0
applet-desc parentDenotes this is the JNLP file for an applet.1.0
main-classThe name of the main applet class.1.0Yes
documentbaseThe document base for the applet as a URL.1.0
nameName of the applet.1.0Yes
widthThe width of the applet in pixels.1.0Yes
heightThe height of the applet in pixels.1.0Yes
param parentA set of parameters that can be passed to the applet.1.0
nameThe name of this parameter.1.0Yes
valueThe value of this parameter.1.0Yes
component-desc parentDenotes this is the JNLP file for a component extension.1.0
installer-desc parentDenotes this is the JNLP file for an installed extension.1.0
main-classThe name of the class containing the public static void main(String[]) method of the installer.1.0Yes

Encoding JNLP Files

Java Web Start software supports encoding of JNLP files in any character encoding supported by the Java platform. For more information about character encoding in the Java platform, see the Supported Encodings Guide. To encode a JNLP file, specify an encoding in the XML prolog of that file. For example, the following line indicates that the JNLP file is encoded in UTF-16.

<?xml version="1.0" encoding="utf-16"?>

Note:

The XML prolog itself must be UTF-8-encoded.