Creating Signable Applet JARs
with CodeWarrior Pro 5



The Problem

The Java Linker jar tool in CodeWarrior Pro 5 is based upon JDK 1.2. It doesn't generate the MD5/SHA hashes like a previous version of the java linker did.

'javakey' from JDK 1.1 doesn't like this. However, they will work fine if you have access to the JDK 1.2 jar signing and verification tool to sign your jar. Obviously, this doesn't yet exist on MacOS.

Workaround

Although the Java Linker does not place the Manifest file at the correct location for 'javakey', the Jar Importer reature of CWP can be used to include an external Manifest file at a location where the 'javakey' tool can find it.

Class Wrangler can be used to generate a Manifest file from its contents, but places this manifest file at the end of the jar file. 'javakey' doesn't like this.

However, using a combination of Class Wrangler to create a correct Manifest file and JAR Importer to place the manifest at the correct position one can use CodeWarrior Pro 5 to create signable JAR files.

Here is a workaround that is cumbersome, and requires that classes don't change during the jar signing process. Once setup once can make a copy of a Project file and the initial Manifest file for other projects.

  1. In the Java Output Settings Panel set your project to generate a JAR file, select both "Compress" and "Generate Manifiest". TIP: Name your output JAR file "Manifest.jar". This will set the default name for saving the Manifest text file to 'Minifest.mf' and save you lots of typing.

  2. Make the Java Applet JAR file.

  3. Create a folder called "META-INF" at the same directory level as your project.

  4. Open the Applet JAR file you just created with Class Wrangler. Ignore any errors (it's because of the Java Linker's "empty" manifest, which Class Wrangler doesn't like & complains about with an incorrect message).

  5. Generate a fresh manifest text file using the following steps. (The 'Generate Manifest' icon is a little glass jar on the right end of the Class Wrangler toolbar.)

    • Click the 'Generate Manifest icon' to full, "Save, ie Command-S".
    • From the "File" menu select "Save Manifest as Text...".
    • Save to a folder "META-INF" using the name "MANIFEST.MF". If you named your JAR "Manifest.jar" this will be the defalt name.
    • Close the file "Manifest.jar".
    • If you have enough memory, leave Class Wrangler running.


  6. From the "File Mappings" setting panel create a new file mapping with a file type of "TEXT", Extension of ".mf", and compiler setting of "JAR Importer". Use any one of the existing "TEXT" mappings as a template then hit "Add".

  7. Drag the "MANIFEST.MF" file from the "META-INF" folder into the project. It doesn't matter where it goes but I like to put in a group named "META-INF". The JAR Importer will merge this file into the output.

  8. Make the output JAR file again. The "MANIFEST.MF" file will get linked in. This puts a valid manifest at the correct location in the JAR file. NB - DO NOT TOUCH OR EDIT ANY OTHER .JAVA FILES PRIOR TO THIS MAKE. THIS WILL CHANGE THEIR MD5/SHA HASH VALUES AND INVALIDATE THE MANIFEST.

  9. Sign the new jar file (Manifiest.jar) with the MRJ SDK javakey tool to create a signed jar file with a different name ie "Applet.signed.jar". If you have enough memory, leave javakey running.

Leave the "MANIFEST.MF" file in your project as you work on your code. However, in order to make a signable JAR file follow these steps: