JNLP : Java Glossary

The JDisplay Java Applet displays the large program listings on this web page. JDisplay requires an up-to-date browser and Java version 1.5+, preferably 1.7.0_04. If you can’t see the listings, or if you just want to learn more about JDisplay, click  here for help.
JNLP

JNLP (Java Network Launching Protocol) for installing the JVM (Java Virtual Machine) and Java apps. Sun has written a specific implementation of it called Java Web Start.

The Java Web Start entry will explain how to set up the *.jnlp to javaws.exe association in your browser and desktop.

JNLP Versions JNLP Validation
Sample JNLP 1.5 The XSD Schemas
Sample JNLP 1.6 The Validator Program
Icons DTD for JNLP
Off/line Snooping
JVM Versions Gotchas
Multiple JNLP Files Learning More
JNLP Tokens Links

JNLP Versions

JNLP comes in three versions. 1.0, 1.5 and 6.0.

New in version 1.5Java version 1.5 or later:

New in version 6.0Java version 1.6 or later:

Sample JNLP 1.5

JNLP is a type of XML (extensible Markup Language).

Sample JNLP 1.6

Here is an example using the most recent JNLP 1.6 specification.

Note the use of <java instead of <j2se and <update check="always" policy="always" />.

The ordering of the sections matters. You must do them in the order jnlp, information, security, update, resources, application-desc, applet-desc, component-desc, installer-desc.

Within the resources sections, order is again important: java, j2se, jar, nativelib, extension, property, package.

You nest <java inside <resources. However, you can nest another <resources inside the <java to describe the resources to use for that JVM only.

Icons

Unfortunately Java Web Start, prior to version 1.6, does not support *.png files for the jnlp <icon image, just *.gif and *.jpg. *.icos and *.pngs are supported in JDK (Java Development Kit) 1.6+. It is best to use a 64 × 64 icon. Unlike *.ico files, you may not specify multiple resolutions. If you used the *.png feature, it would cut off the many users still on Java version 1.5. Note that this image is not in the jar. It has to be downloadable separately by Java Web Start before the jar is.

Off/line

If the app needs to be online to execute, remove the <offline-allowed/> from the information section. Beware, some websites erroneously document the parameter as <allow-offline/>.

JVM Versions

<j2se version="1.3+" /> Does not mean that JDK version 1.3 or higher will be just fine. It means that any 1.3 version will do except a beta or ea. It does not imply a 1.4 will do. Others claim it does. I have not performed the experiments. To be safe, I insert lines for each acceptable version.

Every time Sun releases a new JRE (Java Runtime Environment), you need to add it to all your JNLP files if you want your clients to be able to access your web start apps with it.

Multiple JNLP files

There are at least two situation where you might use two JNLP files for a single application:
  1. When you have an installer. It needs its own separate JNLP file.
  2. When some jars are signed with one certificate and others with another. You need an JNLP file for each different certificate and its jars.
You chain the secondary JNLP off the main JNLP with a line after the <jar:
<!-- chaining off an auxiliary jnlp file from the main one -->
<extension name="Installer" href="esperinstaller.jnlp"/>

JNLP Tokens

There are three magic tokens you can use in field names. They will be replaced when the jnlp script is executed. Unfortunately, I have not been able to discover out what strings they generate: $$codebase, $$context and $$name. I suspect codebase= "$$codebase" means use the directory where you found the jnlp file as the codebase. $$name might be the name of the jnlp file. It is possible to write JNLP scripts without a codebase starting with JDK 1.6. I have not yet tried this out myself. I suspect you have to use JavaScript which is jumping out of the frying pan into the fire.

JNLP Validation

You can check that your JNLP file is correctly formed using an XSD (XML Scheme Definition) Schema originally from Vampqh. You must copy the JNLP 1.0 XSD schema posted below into the current directory as file jnlp1.xsd or jnlp6.xsd then run the Java validation posted below with:

rem Validate a JNLP file with CMP ValidateJNLP utility
java.exe ValidateJNLP jnlp6.xsd C:\mydir\myapp.jnlp

The XSD Schemas

This is an XSD schema to validate JNLP 1.0 :

This is an XSD schema to validate JNLP 1.5. It was mechanically generated by Stylus Studio from the Sun JNLP DTD (Document Type Definition). I modified it slightly to allow both :

This JNLP 1.6 schema was mechanically generated by Stylus Studio from the Sun JNLP DTD. I modified it slightly to correct two syntax errors in the DTD and to allow both an application and installer.

The Validator Program

The above validator is not user friendly. You can get a good idea what it is looking for by reading the XSD file. You would be surprised how many errors you will find.

Unfortunately, Vampqh’s fancier validator, Vanessa, is no longer available.

DTD for JNLP

Sun has posted a  and  According to Piotr Kobzdaemail Piotr Kobzda there are errors in Sun’s posted JNLP 6.0 DTD, and Andrew Thompsonemail Andrew Thompson concurs.
<!ELEMENT update>
should be:
<!ELEMENT update EMPTY>
and
<!ELEMENT shortcut (desktop? menu?)>
should be:
<!ELEMENT shortcut (desktop?, menu?)>
view

Snooping

One way to learn JNLP tricks is to snoop on the JNLP files of other people’s applications.

rem jnlpview.bat viewing a JNLP file.
javaws.exe -viewer
rem then right click on the installed JWS app and click show JNLP file.

Gotchas

Learning More

Oracle’s Technote Guide on JNLP syntax : available:
Changes to JNLP spec 2009-01
JavaScript JWS launcher
cooktop
DTD
JaNeLA: JNLP verifier
Java Web Start
List of possible arch parameters
Lopiqua JNLP quick reference
Stylus Studio
Validating JNLP with a DTD
XML: JNLP is a type of XML and thus uses XML editing and validation tools
XSD

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/jnlp.html J:\mindprod\jgloss\jnlp.html
logo
Please email your , letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email. If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, please quote it and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. Threatening to kill me or spouting obscenities has yet to persuade me to change my mind.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.212]
You are visitor number 46,985.