The security model is similar, but in JNLP it is much more flexible. There are two main
levels of security: for trusted applications and for un-trusted ones that may still access
local resources, but only after the end-user gave her explicit permission. Have a look at
Chapter 10 for details.
An application deployed with JNLP could be launched from a Web page or, to be more
precise, from a URL eventually pointed at by another Web page.
Some differences with the applet model are useful to point out as well.
• The applet lifecycle is rigidly defined once and for all, with little or no control on the
details. On the other hand, the JNLP protocol uses XML files, which allows a much
richer definition of a great number of details.
• Applications launched with JNLP are first downloaded locally, cached opportunely, and
then executed (all automatically). Applets instead are part of the Web page currently
viewed in the browser, and are generally much more limited in their execution environ-
•Of course, the biggest difference from a developer's viewpoint is that JNLP-launched
applications are full-fledged Java applications, with very little restrictions on how to
retrieve resources like icons or files.
We said that JNLP is a Web-centered protocol. What does this mean exactly? It means
that all the items are identified by URLs. Java itself isn't as Web-centered as one may
think. Take the classpath concept, for instance. It is a list of local files and directories
in which the JVM and applications can find their resources. There are no URLs, only
entries in the local file system. It should be no surprise that the classpath mechanism
is not supported in the JNLP protocol, even when specified in JAR files.
Now it is time for some examples that will introduce the JNLP technology. The next chapters
will dig into the details, both with technical advice and with practical code.
Setting Up the Topic Examples
Go to the companion Web site, and download the whole example pack; or do the examples
chapter by chapter, if you like. You will find JAR files and “ b2 ”directories containing both
sources and needed resource files.