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
Using Conftest to Validate Configuration Files
Conftest is a utility within the Open Policy Agent ecosystem that helps simplify writing validation tests against configuration files. In a previous blog post, I wrote about using the Open Policy Agent utility directly to […]
SwiftGen with Image & Color Asset Catalogs
You might remember back in 2015 when iOS 9 was introduced, and we were finally given a way to manage all of our assets in one place with Asset Catalogs. A few years later, support […]
Tracking Original URL Through Authentication
If you read my other post about refreshing AWS tokens, then you probably have a use case for keeping track of the original requested resource while the user goes through authentication so you can route […]
Using Spring Beans in a Kafka Streams ExceptionHandler
There are many things to know before diving into Kafka Streams. If you haven’t already, check out these 5 things as a starting point. Bullet 2 mentions designing for exceptions. Ironically, this seems to be […]