Deploying with the LWJGL Applet Loader 1 - Basics

Introduction

Basics - Part 1

Customisation - Part 2

Compression - Part 3

Polish and Tweaks - Part 4

The AppletLoader requires no java code to use and is controlled entirely through HTML. It is found in the jar file lwjgl_util_applet.jar which comes with the LWJGL download distribution. This is the only jar you need to add to the applet tag unless your using lzma files in which case you'll also add lzma.jar.

In order to use the AppletLoader you must set its main class in the applet tag. This is done as follows:  

...

Once you have set the AppletLoader in the applet tag, everything else is set and controlled using parameters.

There are 3 main parameters you should be aware off, namely, al_title, al_jars and al_main.

al_title

You use this to name your applet, this will also be the name of the directory that your LWJGL applet files will be cached in. Be sure to use a unique al_title value for each different applet you use to avoid files of the same applet being saved in a different applets cache.  

al_jars

This variable will contain all the jar files your applet needs. Files should be listed and separated by a comma. These are the files that the AppletLoader will download and add to the java classpath during the loading screen.  

al_main

This parameter is used to tell the AppletLoader which is the main class of your applet. Once the AppletLoader is done it will pass over control to this class.  

Finally you must specify to the AppletLoader which native files to use. You simply put all the native files for each platform (win, mac, linux, etc) into jar files (same as zip files). So you'd have something like windows_natives.jar, linux_natives.jar, mac_natives.jar, etc. You then put the native jar for each platform into its corresponding parameter. The AppletLoader will automatically detect which platform you are on and only download the natives needed for the platform its on. You must use the al_windows, al_linux and al_mac parameters (other platforms are available but for simplicity we will only cover the 3 big ones). You should have something like:    

Code Signing

Follow these instructions to sign your JAR files.

You must sign the AppletLoader (lwjgl_util_applet.jar) as it requires elevated permissions. The jars containing the native files must also be signed with the same certificate(s) as lwjgl_util_applet.jar. As for the files in the al_jars parameter you can use a mix of signed and unsigned jars if you like. Files which require access outside the applet sandbox must be signed e.g. lwjgl.jar must be signed as it uses resources outside the sandbox. If your using your own certificate it easier to just sign all the jars.

Signing is probably the most tricky part of this tutorial and the fact that a proper certificate costs money. However the LWJGL project provides a LWJGL Applet download bundle that comes with pre-signed jars with a proper certificate. Its recommended if you don't need to sign your own jars that you just use the pre-signed LWJGL jars, as the more common LWJGL's certificate becomes the more chance that users have already accepted the certificate and thus they won't receive another permissions dialog.

You should avoid signing jars with multiple certificates as this leads to a poor user experience as it will causes multiple dialogs to be shown (one for each certificate). Remember signing an already signed jar with a different certificate doesn't replace the older certificate but adds another on to the jar. An easy way to clear a certificate from a jar is to just open it and delete the META-INF folder.

That should be all you need to know to get a basic LWJGL Applet working with the AppletLoader. You should have something like the following

 

  <param name="al_jars" value="mygame.jar, lwjgl.jar"> <param name="al_windows" value="windows_natives.jar"> <param name="al_linux" value="linux_natives.jar"> <param name="al_mac" value="macosx_natives.jar">

Introduction

Basics - Part 1

Customisation - Part 2

Compression - Part 3

Polish and Tweaks - Part 4

Tutorial Credit - Ninja Cave