Customizing Java Applications

If you have some individual class files, you can use the jar tool to package them up into one or more jar files. Once you have jar files, you can transform them to double-clickable jar files, or wrap them in shell scripts or AppleScripts.

This section shows you how use the Jar Bundler tool (/Developer/Applications/Java Tools) that you used earlier to customize a Java application.

Start the Jar Bundler, and then click the Choose button and navigate to the Jar Bundler.jar file that you copied to the Desktop. The next step is to select the Main class, as shown in Figure 16-6.

The Jar Bundler tool

Figure 16-6. The Jar Bundler tool

It may surprise you to find that there is more than one choice. The application can be started using the JarBundler class as we have done, or the JarInspector class. The technical reason is that they each contain a method with this signature:

public static void main(String[] args)

Choose JarBundler, and leave the rest of the options set to their default values. Select the Classpath and Files tab, and you will see the jar file already included in both headings. You also need to add libgetNSImage.jnilib to the Files and Resources section, as shown in Figure 16-7.

The classpaths and Files tab

Figure 16-7. The classpaths and Files tab

For now, we won’t set any properties, so click the Create ...

Get Mac OS X Panther in a Nutshell, 2nd Edition 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.