Double-clickable java application on Mac OSX

Like it says- I want to be able to double-click on something and have it execute my java app.
I do NOT want to use webstart OR .jar files. They’ve caused me too much damn pain, because webstart is complicated and .jar files, in my experience, do not play nice with native libraries (they expect them to be in the same directory.)
I DO want to be able to move the directory containing the executable and class files around (because I want to distribute this to other users.)
I DO want to be able to put the executable in a different directory from the root directory for the java classpath (because I don’t want users to be confused by a dozen other icons in the same folder.)

Basically, what I was going to use was a simple .command file:


cd MyGameDirectory
java -cp .:lwlgl.jar:lwjgl_util.jar:lwjgl-debug.jar rep.game.GameTest

…But a .command file insists on absolute, rather than relative pathnames, so that doesn’t work, and I can’t move around the directory if I do use absolute pathnames.

Anyways- any help would be appreciated.

Maybe you can include everything (natives, data, libs) in the jar file and then have it unpack the natives. This is how jME3 does it and no-one is having issues with it so far.

Use application bundle which is a standard way to store and launch applications on Mac OS X. You can create it manually and use eg. bash script for your executable, or use Jar Bundler application for creation of one automatically. I think you have to install developer tools (XCode) to have Jar Builder application, you can download it from Apple (it might be also included on some of OSX install discs).

As for distribution, the most preferrable way is to use *.dmg files, you can create them using Disk Utility. Alternatively you can also use *.zip or .tbz (.tar.bz2).

Yup, this is the same way I do it. Works very well. I can send you the application if you want, rather than forcing you to download the whole like 3GB of developer tools.

More information about application bundles specifically aimed at Java developers: http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html#//apple_ref/doc/uid/TP40001885.

Thanks a lot for the help (sorry about the delay in replying.)

Java Web Start is not complicated and you could use IzPack to have a very clean and professional installer.