Java Reference
In-Depth Information
• If you need to access your JAR files only for their content, and you don't care about their
physical position, the usual resources element will work perfectly. This is the most
common case, by far. You will see dozens of these cases in this topic. The same thing
applies to native libraries that need only to be loaded by the JVM (by means of the
System.loadLibrary method) to be usable by the launched application. For this latter
requirement, use the nativelib element as described later.
•Installing the so-called optional packages is a quite common need. What are they? Once
they were called standard extensions; they could be a mix of Java code and native
libraries required to extend the JRE. Typical examples are input methods for non-Latin
alphabets, products such as Java Advanced Imaging, Java3D, Java Secure Socket
Extension (JSSE), and so on. If you are in need of installing something like that for your
JNLP-launched application, Listing 11.6 does just that. Have a look at the Java reference
documentation for optional package details.
•Ifyour application requires the installation of native libraries—that is, non-JAR files in
some defined locations on the local file system—you can resort to a custom installer.
Take a look listings 8.7, 8.8, and 8.9 in Chapter 8, “A JNLP Quick Launch,” for some
concrete Java code that does it with JNLP. Another similar case involves needing to
know where downloaded executable files are, in order to launch them or to manipulate
them in some way. With this technique, native installers and in particular native libraries
could be installed via JNLP. If this is your requirement, be sure to make use of Listings
9.3, 9.4, and 9.5 in Chapter 9. Also, Chapter 13, “A Complete Example,” has some useful
code concerning this aspect.
• Something helpful is to organize your libraries into a set of JAR files with their own
installer code arranged like an individual unit, so that different programs could use them
by means of a single link without having to always rebundle those six-or-so JAR libraries
together with your single JAR of application code. If this is what you are looking for,
you should try the JNLP component-desc element, described later in this chapter.
N OTE
Generally speaking, before writing all the code to download your resources in a cus-
tom installer from scratch, you should try to figure out how the JNLP technology
could help you. After all, this is what downloading and automatically caching your
resources is all about…hopefully minimizing developers' efforts in the process.
Focusing on the JNLP file, there are six possible subelements for the <resources> element:
<jar> and <nativelib>, which describe code resources; <j2se> , <property> , <package> , and
Search WWH ::




Custom Search