Have a look at the appbundler project on java.net. It provides an Ant task that will package your application up as a normal Mac .app
bundle, and can optionally include an embedded JRE.
The whole Java landscape on Mac is a bit of a mess at the moment as we're still in the transitional period where Java 6 releases are supplied and maintained by Apple and Java 7 releases come direct from Oracle. The jarbundler project referred to by a_horse_with_no_name is for wrapping up a JAR as a .app
bundle that will run on the Apple-supplied Java 6 that is included with Mac OS X 10.5/6/7, but not on Oracle Java 7, conversely appbundler targets Oracle Java 7 and its .app
bundles won't run on Java 6.
If you want to target recent Macs running 10.7 or 10.8, and in particular if you want to distribute your app via the Mac App Store, then you should use appbundler and bundle a copy of the JRE. If you don't want to distribute via the store then the embedded JRE is optional. If your app can run on Java 6 then targetting Apple Java 6 with jarbundler will mean your app can run on older (<= 10.6) Macs. But then anyone with a more recent Mac that has only Java 7 will be prompted to download and install Java 6 when they try and run your app.
It's fine to distribute the .app
in a .zip
archive, as long as everything in the Contents/MacOS
directory (and the appropriate files in the embedded JRE if applicable) inside the app is marked with execute permission in the zip file. If you're building with Ant you'll need to use <zipfileset>
s with the right filemode
.
.exe
launchers. The building of the launcher can be done on Mac/Linux but the resulting launcher will run on Windows only. – Altitude