Monday, May 15, 2006

Java Web Start shortens my time on earth

First, for posterity, you can make a JNLP file into a JSP file (for dynamic control) by simply calling your file something.jsp instead of something.jnlp and using the line

<%@ page contentType="application/x-java-jnlp-file"%>

at the very top.

Now, on to the main article.

The problem: I want to use JOGL (some Java API for OpenGL) to make a web start application. This will need some jars to be signed. JOGL's release jars are signed already--by Sun--but you will need to sign any jars you make. This leads to the error

JAR resources in JNLP file are not signed by same certificate

Luckily, Google found a nice discussion here: In short, you can work around the problem by using the tag in your JNLP file. To use the default jogl jars, use simply this:

<extension name="jogl" href=""/>

The downside is of course you are now a slave to the JOGL archives. If you want to
guarantee the jogl jars used at download are the ones that are compatible with your compilation, you will need to work out your own salvation. First, change the extension URL to your server in your JNLP file:

<extension name="jogl-stuff" href=""/>

Then create your extension JNLP. The easiest way to do this is to cheat: use the wget command (on linux/unix) to grab the "official" JOGL JNLP and then edit it.

[shell-prompt> wget

After editing, your jogl-stuff.jnlp file will look something like

<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="" href="jogl-stuff.jnlp">
<vendor>Sun Microsystems, Inc.</vendor>
<homepage href=""/>
<description>JOGL - JSR-231 Current Build</description>
<description kind="short">Java programming language binding for the OpenGL 3D graphics API. (Current build of JSR-231 APIs)</description>
<jar href="jogl.jar" />
<resources os="Windows" arch="x86">
<nativelib href = "jogl-natives-win32.jar" />
<resources os="SunOS" arch="sparc">
<nativelib href = "jogl-natives-solsparc.jar" />
<resources os="SunOS" arch="x86">
<nativelib href = "jogl-natives-solx86.jar" />
<resources os="Linux" arch="i386">
<nativelib href = "jogl-natives-linux.jar" />
<resources os="Linux" arch="x86">
<nativelib href = "jogl-natives-linux.jar" />
<resources os="Mac OS X" arch="i386">
<nativelib href = "jogl-natives-macosx.jar" />
<component-desc />

No comments: