Java Reference
In-Depth Information
L ISTING 9.8
Continued
<param name=”Param1” value=”Value1”/>
<param name=”Param2” value=”Value2”/>
</applet-desc>
The main use of this kind of JNLP file is for taking advantage of the JNLP Client environment
(deployment and runtime services) for existing applets. Generally speaking, previous to a
JNLP introduction, developers sometimes made improper use of applets, trying to address
problems that were too complex for the applet model. In this case, a complete rewriting of the
code to transform the old applet in a JNLP-launched application is probably the best solution.
Otherwise, if your code conforms nicely to the applet model, don't forget the Sun Plug-In
shipped with the JRE, which still remains the best choice for running applets.
We can see a JNLP file describing an applet in Listing 9.9.
L ISTING 9.9
An Example of a JNLP File Describing an Applet
<?xml version=”1.0” encoding=”UTF-8”?>
<jnlp spec=”1.0+”
codebase=”http://server/b2/c9/”>
<information>
<title>1 applet</title>
<vendor>Mauro's Workshop</vendor>
<offline/>
</information>
<resources>
<j2se version=”1.2+” />
<jar href=”applet.jar” />
</resources>
<applet-desc
main-class=”com.marinilli.b2.c9.AnApplet”
name=”jnlp applet”
width=220
height=100>
<param name=”name” value=”gus”/>
</applet-desc>
</jnlp>
9
N OTE
Despite being quite simple, the JNLP support for applets allows developers to specify
the JRE environment needed for running the applet.
Search WWH ::




Custom Search