So you’ve written your killer SWT app and you’re keen to bundle it in a nice clickable Mac application bundle for distribution on OSX? Such has been my journey for last few days. I reckon I’ve sunk around 10 hours into just this process over the last week, but I now have it working. First, let me show show off: (it’s good therapy)

PasswordSafeSWT Icon in the Finder

Ok, the resources that you need to read are:

I’m a Mac newbie, so it took me a while to work out why my app would launch, bounce a few times in the dock, then die. You can find out why via the Console application (Applications/Utilities/Console) - which is where the errors get dumped from the lauching process. That’s when I worked out it couldn’t load the .jnilib files even though they were in java.library.path (since they weren’t chmoded executable).

The other thing that I couldn’t get working was using $JAVAROOT in an Info.plist setting for java.library.path. It would just never get expanded by the launcher. I ended up cutting my losses and just copying the my .jnilib files to the same directory as the rest of my jars.

BTW, I’ve been using the jars from Eclipse 3.1RC1 to get all this happening. Earlier jars required you to use a special java_swt launcher to fix those threading issues I was talking about, but the 3.1 stream just uses the standard JavaApplicationStub launcher which is just easier all round.

Eclipse 3.1 also has this “Export To… Mac App Bundle” option but it just tanked every time I tried it, so that might be one to sleep till the final release.

Have fun! Hopefully all this will save you some pain!