Convert .jar to an OSX executable?
I made a Java application which I would like to distribute on Windows, OSX and Linux without distributing a jar file. I used the great Windows exe wrapper http://launch4j.sourceforge.net/ to create an .exe file complete with my icon that won't scare Windows users.
Are there similar wrappers that I can use for OSX/Unix? An important consideration is that I would like to have my own icon on the executable (especially for mac users).
Thanks!
Solution 1:
Yes, on Mac OS X there is a program called Jar Bundler that is installed when you install the free (assuming that you already own a copy of Mac OS X) Xcode Developer Tools that allows you to bundle a JAR file inside a native Mac OS X "*.app" application bundle with a nice and shiny icon just like other apps.
Update
The JAR bundler doesn't exist on later versions of OS X. As a workaround, you can manually create an OS X project that invokes Java. Or, there are a variety of build system extensions that do a similar thing; for example, the gradle-macappbundle plugin for Gradle will create such a wrapper app.
Solution 2:
JarBundler is obsolete, but there is a (better) official replacement: the javapackager tool.
For OSX, A simple, well explained, step by step tutorial on how to create a DMG from java is here: http://centerkey.com/mac/java/ . For other platforms, you just need to modify the example by using the proper switches in javapackager.