[MAC OSX] JarBundle - A simple jar bundling application

I was looking for a simple way to package my jar file into a mac Application Bundle a few hours ago. It appears that you can no longer get the bundling application through xcode, or at least, I couldn’t find it… So, I made this :slight_smile:

Download it here.

Features:

  • load jar file
  • load icon (uses any PNG file)
    [sub](I know that’s quite a hefty list).[/sub]

This will not work on any os besides mac OSX, as I used two shell commands that are OS specific. (One for converting the icon preview image to a .icns file, and the other to execute the “launcher” file).


This might be the messiest application I have written in awhile; I started writing this at 4:00 AM.

I’ve made a similar one before (using shell scripts). Also works with linux.

Unl8dgqFv6o

All you require is to edit the launcher script and give it executable permissions.

Ah you were the one that posted that!
I used this as a reference when I made the application :slight_smile:

I’ve thought of making a GUI version, but didn’t had OSX installed right now. Why not add more options? Allow native libs? and custom VM args?

I might do that :slight_smile:

There’s also Packr
Might be handy if you haven’t seen it.

@BurntPizza

I’ve seen that, but I wanted my app to be used with Swing apps in general. Though I haven’t used it, it looks pretty nice.

Packr can bundle swing apps last I checked.

Hi

Why haven’t you used existing projects like those ones?
https://java.net/downloads/appbundler/appbundler.html
https://sourceforge.net/projects/jarbundler/

I haven’t still tested the APP file I generated with PackR…

Because I like to have a gui display :slight_smile:

@gouessej

I’ve seen that AppBundler task before, but haven’t worked with ant before (Just used Eclipse to build). Haven’t seen that JarBundler. Moreover, I already knew the app bundle structure on Mac OS, so I implemented mine with shell scripts (which I’m better at)

@orange451 It is possible to build a GUI above an existing library.

@SHC Does your stuff support very recent versions of Mac OS X?

@gouessej

Yes. I’ve tested it with Mountain Lion and Mavericks too. Only thing is that you have to kill the finder and open it again to recognise it as application in mavericks 10.9.3

@orange451 Do you use hdiutil (to make a DMG file)? It’s possible to make an icns file in Java:
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java?view=markup
Look at the method writeImage(final BufferedImage src, final OutputStream os, Map<String, Object> params).

I don’t know whether you are interested in making your tool work with other operating systems. Personally, I hate being forced to use a Mac to create a Mac application bundle for a Java application.

Moreover, Packr puts a JVM (OpenJDK) into the bundle, it’s really great because fewer Mac users have Java installed and it allows to work around the bugs caused by crappy or obsolete Java libraries installed as extensions. Implementing this option isn’t very difficult, you just have to download an OpenJDK build, unzip it in the right subdirectory and modify your launcher in order to use it instead of the system JVM.