Apple’s developer tools come with a neat utility for bundling Java jar file into a Mac OS X application: Jar Bundler.

It can be found at /usr/share/java/Tools on Lion.

First add your Jar file to the “Additional Files and Resources” panel. It should contain a Main Class (i.e. be a Java Application).

Specify the Java Main Class name and other Mac OS X specific options (e.g. Application icon, whether Java Swing’s JMenuBar should use the Mac OS X menu bar…).

Finally, specify other Application specific properties (e.g. version). You can also specify the JVM heap memory size (in MB) and other JVM options from here.

There you go, here is the Package Contents of the resulting Mac OS X application!

The resulting application is now well integrated into Mac OS X as shown in this Finder Get Info dialog.

The Java app used in the above example is PageSucker. The latest version is 3.2 but only exists for Windows, Mac OS 9 (Classic) and Mac OS X, but for PowerPC only. Using the instructions in this post will allow you to create an Intel compatible application for Mac OS X (including Lion…).

If you are lazy, you can get the version I did for Mac OS X 10.7 Lion: PageSucker.app.zip (not a real PDF, but a zip file…).

Advertisement