The JNLP File Structure
A basic template of a JNLP file for describing applications is shown in Listing 9.1. Extension
descriptors' structure is very close to the application descriptors' structure. This template can
be used as a starting point when creating your own JNLP main file.
L ISTING 9.1
A JNLP Application Descriptor Template
<?xml version=”1.0” encoding=”UTF-8”?>
<jnlp spec=”1.0+” codebase=”http://www.mysite.com/application/” ...>
<information> ... </information>
<security> ... </security>
<resources> ... </resources>
<application-desc> ... </application-desc>
Once the JNLP technology seems viable for solving your problem, the following decisions
have to be made when writing JNLP files:
• Whether JNLP extension files are needed (that is, if some control over the installation is
needed). Without custom installers, JAR files will be automatically downloaded and
saved in the JNLP Client's cache. Also, determine whether libraries should be factored
out in component descriptors.
• Which operations your application need to perform, in relation to security. If it has to
access local disks or use native libraries, and so on. This will define the kind of security
setting in the JNLP file. Note that if you need a custom installer (see the previous item in
this list) that will write on the local disk, you need an unrestricted security environment
(see Chapter 10).
• Whether to take advantage of the runtime services offered by the JNLP Client. This
could result in an inability to run the application outside the JNLP Client's container. We
will see a Java library that addresses this problem. This utility library will be used in the
example in Chapter 13 and its code is discussed in Appendix D.
These decisions will also affect your Java code, not only JNLP files. For loading items
in resource JAR files or for accessing runtime services, you could need to modify your