Java Reference
In-Depth Information
Native Libraries
When instructing JNLP Clients to use native libraries, it is important to specify which platform
they are intended to be used on. The three attributes of the <resource> element are suited for
this. A typical native library JNLP definition looks like the following:
<resources os=”Windows” arch=”x86”>
<nativelib href=”libraries/winlib.jar” />
When this level of definition is not enough (for example, when more detailed information is
needed on already installed native libraries) developers need to explicitly write the code to per-
form the installation.
To invoke the installation of native libraries from Java code, use the
System.loadLibrary(..) method (which is not available for unsigned applications).
See the “Security” section later in this chapter.
There is a little problem when trying to lazily download a native library. Using the download
attribute won't work because according to the JVM specification, the classloader is not
invoked when a native library is missing and needs to be retrieved. The only way to accom-
plish the lazy download behavior is to synchronize the download using the part attribute:
<jar href=”a.jar” part=”part1” kind=”lazy”/>
<resources os=”AIX”>
<nativelib href=”libraries/aixlib.jar” part=”part1” kind=”lazy”/>
In this way, the loading of the a.jar resource will trigger the download and installation of the
aixlib.jar native library, whenever the first happens.
System Properties
Adding the following line into a resources element causes the JRE to set the property to that
given value. Just as in the command-line “D”-definitions, the JNLP XML code looks like the
<property name=”???” value=”???”/>
See the section about security for the properties accessible to the various level of security.
Search WWH ::

Custom Search