Setting up a signed framework using webdist-all

I was wondering if there was some documentation talking about how to setup JME jar signing for doing JME applets.  I looked at the applet page under the user manual, which mentioned it, but I'm still not sure how to do the signing. 



For example, if I do a webdist-all build, which is what I assume signs the libraries, it fails by default probably because I'm not setting up the proper code to do this.  Is there somewhere that tells me how to get this setup?  Also, will this sign the LWJGL libraries as well leaving only my particular jar to be signed by myself? 

If you use jme 2.0 and thus lwjgl 2 rc 1, you need to use the new lwjgl applet loader anyway.

And lwjgl already provides signed native libraries for jinput, openal and lwjgl.

Here you can get the lwjgl_applet-2.0b1.zip, which contains the lwjgl_util_applet.jar (the appletLoader class) and the native libraries lzma packed.

The AppletLoader downloads and installs the needed jars onto the clients pc.



So, all you have to do, is build the jme jars as usual and sign them with your own certificate like a webstart app.



this is how the applet code should look:


<applet code="org.lwjgl.util.applet.AppletLoader"  archive="lwjgl_util_applet.jar, lzma.jar"  codebase="../applet_jars"  width="640" height="480">
<param name="al_logo" value="appletlogo.png">
<param name="al_progressbar" value="appletprogress.gif">
<param name="al_jars" value="lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, res.jar.lzma,../appl_jar/AppletTestTerrain.jar,../jme_jars/jorbis-0.0.17.jar,../jme_jars/jme.jar,../jme_jars/jme-awt.jar,../jme_jars/jme-audio.jar,......,../jme_jars/jmetest-data-texture.jar">
<param name="al_title" value="Applet_AppletTestTerrain">
<param name="al_main" value="AppletTestTerrain">
<param name="al_windows" value="../jme_jars/windows_natives.jar.lzma">
<param name="al_linux" value="../jme_jars/linux_natives.jar.lzma">
<param name="al_mac" value="../jme_jars/macosx_natives.jar.lzma">
</applet>

I downloaded the svn trunk from Google Code, which said it was JME 2.0.  I assume then that the lwjgl jars in the file are from rc 1 then.  Are they signed coming in from the trunk? 



The error message I get running it from appletviewer complains about an LWJGL AccessException.  Is that because the lwjgl jars aren't signed, or because JME isn't signed and is trying to use them? 



If I understand right, I need to:


  1. Compile JME
  2. Sign it's build jars (I'll google how to do that)
  3. Compily my app using JME
  4. Sign my app.jar
  5. Use the html you provided in test.html



    Does that seem correct?  Is there a way to have the JME jars signed at build time in the ant script so it doesn't fail using webdist-all? 



    Thanks. 

You need to sign the jme jars and your own jar that you build. (or else you will get access exceptions)



Basically all jars need to be signed :slight_smile: but the lwjgl jard and natives.lzma are pre-signed.

How to sign the jme jars is described in the webstart step by step wiki



I’m actually in the process of writing a little web app, where you can paste your own code and create a webstart from a SimpleGame or a applet from a SimpleJMEApplet :).



the way i do it is:

  • compile the pasted code into a .class
  • create a jar from the .class
  • sign the jar
  • create the html code for the applet or the jnlp file for the webstart


So in this case, is lzma.jar the name of your applet?  I'm not quite sure what lzma is. 



Using this html:


<center>
<applet code="org.lwjgl.util.applet.AppletLoader"  archive="lwjgl_util_applet.jar, lzma.jar"  codebase="./lib"  width="640" height="480">
<param name="al_jars" value="lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, res.jar.lzma,../appl_jar/AppletTestTerrain.jar,./lib/jorbis-0.0.17.jar,./lib/jme.jar,./lib/jme-awt.jar,./lib/jme-audio.jar,......,./lib/jmetest-data-texture.jar">
<param name="al_logo" value="appletlogo.png">
<param name="al_progressbar" value="appletprogress.gif">
<param name="al_title" value="Applet_AppletTestTerrain">
<param name="al_main" value="AppletTestTerrain">
<param name="al_windows" value="./lib/windows_natives.jar.lzma">
<param name="al_linux" value="./lib/linux_natives.jar.lzma">
<param name="al_mac" value="./lib/macosx_natives.jar.lzma">
</applet>
</center>



And my ./lib one down from where I run applet viewer:


jinput.jar       jme-gamestates.jar       jmetest.jar
jme-audio.jar    jme.jar                  jme-xml.jar
jme-awt.jar      jme-model.jar            lwjgl.jar
jme-collada.jar  jme-scene.jar            lwjgl_util_applet.jar
jme-editors.jar  jme-swt.jar              lwjgl_util.jar
jme-effects.jar  jme-terrain.jar
jme-font.jar     jmetest-data-images.jar

the .lzma files (archives like zip) come from the lwjgl_applet-2.0b1.zip, which can be downloaded from here: lwjgl sourceforge page



The AppletLoader extracts these lzma files which contain the main lwjgl jars and native libraries when the applet is started.

The main class is defined the parameter ‘al_main’, which is AppletTestTerrain in my case. (in the appl_jars folder)

In your lib folder, you only need to have the jme jars and the jars/lzma files from the lwjgl zip.

Great.  My last problem (I hope) still relates to jarsigning.  I get


lzmaSupported: true
pack200Supported: true
Fatal error occured (2): access denied (java.util.PropertyPermission java.io.tmpdir read)



when running my code through appletviewer.  Looking at various forums say it's a signing issue.  I've signed my personal jar I made as well as the jme jars I use.  Should I sign all the lwjgl jars, too?  I assume the lzma files don't need to be touched.  I was considering just trying to sign every jar file with my key, but didn't want to screw too much up. 

hmm well, the lwjgl.jar file, that comes with jme is not signed but that is not used anyway.



The lwjgl from the sourceforge download lwjgl.jar.pack.lzma should be signed, so you should only need to sign all.

Maybe you are using the wrong lwjgl_util_applet.jar, make sure you don't use the one jme provides, but the one from the sourceforge zip, which is oddlabs signed.



A jar can be simply unzipped with winzip and see if its signed.

Okay, I tried going step by step.  If I extract lwjgl_applet-2.0b1.zip into its own directory and open the example applet, I get the same error.  Using "jarsigner -verify" I see lwjgl_util_applet.jar but lzma.jar is not.  If I sign lzma.jar myself so that both jars that come with lwjgl_applet-2.0b1.zip are signed, I still get the same error. 

humm i don't know.



this is my base folder for my applet und webstarts, (you can browse and compare):

http://www.core-dump.ch/gwt/ 

/applet_jars  contains the lwjgl jars and lzma's

/jme_jars contains the jme-jars which i signed

/appl_jar contains the jar with the main class, which i also signed.



maybe this helps

Great.  I think I got most of my other issues resolved at the LWJGL forum.  I think I just have one more question relating to JME.  When running the demo applet code I pieced together from the JME wiki, I get the following error in the java console:



"Error creating input provider"



Am I excluding an jar that needs to be in the code path?  I just added some random jars to get rid of the class-not-found exception but am not sure what to do about the input provider problem. 



<applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar, lzma.jar, Life.jar, ./lib/jme.jar, ./lib/jme-awt.jar, ./lib/jme-audio.jar, ./lib/jme-swt.jar, ./lib/jmetest.jar" codebase="." width="640" height="480">

did you add jinput.jar.pack.lzma to the al_jars parameter ?

hmmm … i'm getting the same error trying to load a jme applet … "Error creating input provider"



this appears to happen in jme code, i've been able to run the lwjgl applet tests fine.



any ideas? (the jme applet that i'm testing this with is just a simpleJMEapplet shell, that does nothing)