The Checkers3D ApplicationThe Checkers3D code is unchanged from the example in Chapter 15, aside from the addition of the installDLL( ) method in the Checkers3D class. Preparing the JARsAs with Checkers3D, I'm assuming that the target machine for the installation doesn't have Java 3D installed, so the test machine where I develop the installation shouldn't have it either. Instead, all of its JARs and DLLs (seven files) are copied to the Checkers3D/ directory (see Figure A-11). Figure A-11. The Checkers3D/ application directorySince Java 3D isn't installed in the standard location, the calls to the compiler and JVM must include additional classpath information: javac -classpath "%CLASSPATH%;vecmath.jar;j3daudio.jar; j3dcore.jar;j3dutils.jar" *.java java -cp "%CLASSPATH%;vecmath.jar;j3daudio.jar; j3dcore.jar;j3dutils.jar" Checkers3D There's no need to mention the three DLLs (J3D.dll, j3daudio.dll, and J3DUtils.dll), which will be found by the JARs as long as they're in the same directory. The Checkers3D classes should be collected into a single Checkers3D.jar file, along with all the required DLLs: jar cvmf mainClass.txt Checkers3D.jar *.class *.dll The manifest information in mainClass.txt is: Main-Class: Checkers3D Class-Path: vecmath.jar j3daudio.jar j3dcore.jar j3dutils.jar The manifest specifies the class location of main( ) and adds the Java 3D JARs to the classpath used by Checkers3D.jar. Changes to Checkers3D.javaCheckers3D contains the same installDLL( ) method as found in BugRunner but calls it three times: public static void main(String[] args) { // DLLs used by Java 3D extensions installDLL("J3D.dll"); installDLL("j3daudio.dll"); installDLL("J3DUtils.dll"); new Checkers3D( ); } The Checkers3D application installed on the user's machine will consist of five JARs: Checkers3D.jar, j3dcore.jar, j3daudio.jar, vecmath.jar, and j3dutils.jar. After the first execution, they'll be joined by the three DLLs: J3D.dll, j3daudio.dll, and J3DUtils.dll. Creating the Checkers3D InstallerThe distribution tree for the installer has the same shape as the one for BugRunner: an Executables/ subdirectory holds the JARs. The directory structure is shown in Figure A-12. The five JARs required by the application are there, as well as custom.jar for uninstallation. It's the same one as used in BugRunner, and no changes are necessary. Most of the other installer configuration tasks are similar to those carried out for BugRunner, such as configuring the executable and Java invocation and the definition of the pre-uninstall action using the DLLUninstallAction class in custom.jar. The Checkers3D InstallerThe resulting installer, called C3D_1.0.exe, takes around 8 seconds to generate and is about 3.6 MB. A version bundled with JRE 1.4.2 comes in at 14.3 MB. Figure A-12. Distribution tree for the Checkers3D installer |