3D on the web with Java and Irrlicht - Getting Started (Page 3 of 3)

Article by Matthew Casperson (4,880 pts ) , published Oct 12, 2009

Signing the JAR file

Once the JAR files have been created they needs to be signed. This is because a signed JAR file is a requirement for the security permissions needed to load a native library (i.e. any call to System.loadLibrary, which is excatly what the Start class does). The keytool.exe and jarsigner.exe tools are used to create the key and use it to sign the JAR file.

First we create a keystore (a location to hold the keys) using the following command:

keytool -genkey -keystore myKeystore -alias myself

Then we create a self-signed certificate with the following command:

keytool -selfcert -alias myself -keystore myKeystore

Finally we sign the JAR file with the command:

jarsigner -keystore myKeystore myjarfile.jar myself

Creating the JNLP file

The last step is to create the WebStart JNLP file.

Jirrtut1.jnlp source code

The JNLP file is self describing, and you can find more detailed information on the format here. However there are two sections that I will point out.

The first is the <all-permissions> tag in <security>. Requesting all-permissions (which enables the System.loadLibrary function) requires the use of a signed JAR file, and allows the application to load native DLL files.

Second is the <nativelib href="native.jar"> tag in <resources os="Windows">. By referencing the native.jar file in the nativelib tag we are telling WebStart to extract the DLL files contained in native.jar in a location that will be accessible to the System.loadLibrary function.

The end result

Developing a WebStart application does require jumping through a few hoops, but for the most part it allows a Java application to be distributed, downloaded, installed and executed on a client PC with a minimum of fuss for the end user.

Check out the online demo here, browse the source code here, and download the source code in a TAR file here.

Images

Java Irrlicht demoWebstart Download Screenshot

Related Articles

away3d logoAway3D Tutorials

Learn how to add 3D effects to web pages using the Away3D Flash 3D engine with these free tutorials.

Showing page 3 of 3
 
Subscribe to Web Development
RSS
Get free weekly updates, directly to your inbox.
Browse Web Development