Java Reference
In-Depth Information
the CLDC/MIDP, the descriptor is an XML file with three main sections: a <resources>
section specifying the required runtime and the location of the JAR file for the applica-
tion, an <information> section indicating the title and vendor of the application, and an
<application-desc> entry indicating the main class of the application. All are wrapped in
a <jnlp> XML tag. Listing 3-13 shows an example.
Listing 3-13. The Descriptor File for WeatherApplet
<?xml version="1.0" encoding="utf-8" ?>
<jnlp codebase="sb:///WeatherApplet/">
<resources>
<Java SE version="1.4+"/>
<jar href="lib/classes.jar"/>
</resources>
<information>
<title>WeatherApplet</title>
<vendor>Ray Rischpater</vendor>
</information>
<application-desc main-class="com.apress.rischpater.weatherxlet.Weather
Xlet">
</application-desc>
</jnlp>
You can write this by hand, or you can have the NetBeans IDE roll a deployment for
you, much as it would a CDC/MIDP deployment. When it does this, it creates a deploy-
ment image suitable for a SavaJe device, with the following directory hierarchy:
bundle.jnlp
bundle.policy
lib/
lib/classes.jar
The bundle.jnlp file is the descriptor you see in Listing 3-13; the bundle.policy file
requests the permissions for the application, like this:
grant codeBase "sb:/WeatherApplet/lib/classes.jar" {
permission java.security.AllPermission;
};
This example requests all permissions; in practice, you may want to apply the princi-
ple of least privilege, which requires that only the permissions required by the
applications be listed in the grant block.
 
Search WWH ::




Custom Search