Java Reference
In-Depth Information
codebase="http://www.darwinsys.com/"
href="/jabadex/">
<information>
<title>JabaDex Personal Information Manager Application</title>
<vendor>Darwin Open Systems</vendor>
<homepage href="/"/>
<description>JabaDex Personal Information Manager Application</description>
<description kind="short">A simple personal information manager.</description>
<icon href="images/jabadex.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5"/>
<jar href="jabadex.jar"/>
<jar href="com-darwinsys-util.jar"/>
</resources>
<application-desc main-class="JDMain"/>
</jnlp>
If necessary, set your web server's MIME types list to return JNLP files as of type applica-
tion/x-java-jnlp-file . How you do this depends entirely on what web server you are
running; it should be just a matter of adding an entry for the filename extension .jnlp to map
to this type.
Also if necessary, modify your application to get its ClassLoader and use one of its getRe-
source() methods, instead of opening files. Any images or other resources that you need
should be opened this way. For example, to explicitly load a properties file, you could use
getClassLoader() and getResource() , as shown in Example 21-4 .
Example 21-4. packaging/GetResourceDemo (partial listing)
// Find the ClassLoader that loaded us.
// Regard it as the One True ClassLoader for this app.
ClassLoader loader = this
this . getClass (). getClassLoader ();
// Use the loader's getResource() method to open the file.
InputStream is = loader . getResourceAsStream ( "widgets.properties" );
iif ( is == null
null ) {
System . err . println ( "Can't load properties file" );
return
return ;
}
Search WWH ::




Custom Search