Aug 3, 2010

Packaging your Java application for the Mac

The Mac has some nice tools to turn your jar file into a first class Mac application. This is most useful if the application has a GUI interface; Swing, SWT, etc. There are three parts to this process:

  1. Package your application as a jar file
  2. Create an icon for your application
  3. Create an application bundle

Some applications referenced below may not be installed on your Mac by default. If not, you can either install them from your distribution or download them.

I assume you already know how to do step one so we’ll move on to step two.

Find an icon you like for your application. A little Googling will produce a variety of free icons. The png file format will work for you. Be sure to follow any licensing restrictions that apply to your icon and do the following:

  1. Download the png file.
  2. Open the Icon Composer application (its in /Developer/Applications/Utilities).
  3. Drag the png file into the largest box in the icon composer.
  4. From the largest box drag it to the next largest then the next and so on to create various size icons. Be sure to go from larger to smaller for the best results.
  5. Choose File->Save in the Icon Composer and save your new icns file.

Finally, build your application bundle:

  1. Open the Jar Bundler (its in /Developer/Applications/Utilities).
  2. Select the Classpath and Files tab and add your jar file to the classpath.
  3. Select the Build Information tab.
  4. Click Choose next to the Main Class drop down, select your application’s jar file again.
  5. Select the entry point for you application from the Main Class drop down.
  6. Select your JVM Version from the drop down
  7. Click Choose Icon and select the icns file you created above.
  8. Click Create Application, enter a name for your bundle, and click Create

Now you have an application bundle file you can just drop in your /Applications directory to install.

About the Author

Object Partners profile.

One thought on “Packaging your Java application for the Mac

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Waypoint and JVM
What are we doing here? We’re going to to run Waypoint to build a Clojure web application, deploy it, and release it on a URL. Along the way, we’re going to see how it interacts […]
Understanding Mutual TLS Options in the Public Cloud
When delivering an API over the public internet via a cloud provider, some organizations and frameworks require mutual TLS verification as a part of the interaction for that API. Mutual TLS can be used to […]
Performance Test Liquibase Update
When doing a liquibase update to a database if you’re having performance issues, it can be hard to find out which updates are causing problems. If you need to measure the time to apply each […]
TICK Stack Monitoring for the Non-Technical
TICK – Telegraf, Influx, Chronograf, and Kapacitor – is a method of monitoring your systems and applications. In this article, I discuss in non-technical terms what the difference is between TICK and Prometheus Grafana A […]