Convert Java application to Mac OS X app

You can use javapackager tool to build the application and wrap it in into an installer, the following commands show how to convert a jar file into a bundle file:

commands

mkdir -p package/macosx
cp Test.icns package/macosx
jdk=$(/usr/libexec/java_home)
$jdk/bin/javapackager -deploy -native dmg \
   -srcfiles Test.jar -appclass package.Test -name Test \
   -outdir deploy -outfile Test -v
cp deploy/bundles/Test-1.0.dmg installer.dmg
ls -l
open installer.dmg

To change the application icon and more info MacJava.


jar2app

Packr is a great tool, but at the time I found that I wanted something "easier to use", so jar2app was born. I know this is an old question but perhaps other people might find this program easier to use than other alternatives. If they don't, there's a direct reference in the FAQ to other alternatives (such as Packr).


There is a library that let's you package your Java app
Packr: https://github.com/libgdx/packr

Packages your JAR, assets and a JVM for distribution on Windows (ZIP), Linux (ZIP) and Mac OS X (.app), adding a native executable file to make it appear like the app is a native app.

It can even minimize the JRE for you.


Use the Apple Java Extensions and its Guide

The Apple Java Extensions contains a very complete development guide with information on the deployment of Java applications on Mac OS X and the production of application bundles. It also introduces other aspects of the Apple Java Extensions, like the support for integration with the standard Mac OS X UI.

Other references:

  • JarBundler.
  • Make a Mac OS X App Bundle
  • Creating a osx app bundle in Java registered to a protocol url