A JWS Installer for BugRunner

BugRunner is a basic 2D arcade game (see Chapter 11. I'll work with the version that uses the J3DTimer class, which means the deployment file must install the relevant Java 3D library. I can't assume it's present on the user's machine.

Write the Application

The installer version of the application shouldn't rely on nonstandard extensions or native libraries being present on the client machine. However, BugRunner uses the Java 3D timer, which is part of the Java 3D extension. The OpenGL Windows version of Java 3D is implemented across seven files:

               j3daudio.jar
j3dcore.jar
j3dutils.jar
vecmath.jar
    JAR files
J3D.dll
j3daudio.dll
J3DUtils.dll
    Native libraries

Tip

The native libraries will vary across different platforms, and the JAR versions may also vary.

Only j3dutils.jar and J3DUtils.dll are needed for the timer functionality as explained in Appendix A. They should be placed in the BugRunner/ directory to be locally accessible to the application. Java 3D should not be installed on your test machine.

Figure B-1 shows the BugRunner/ directory prior to compilation. It contains all the Java files (unchanged from Chapter 11), j3dutils.jar, and J3DUtils.dll. The batch files are optional but reduce the tedium of typing long command lines.

Since Java 3D isn't installed in a standard location checked by javac and java, the calls to the compiler and JVM must include additional classpath information. The compileBR.bat batch file contains this line:

 javac -classpath ...

Get Killer Game Programming in Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.