Forking the OpenJDK for fun and profit.

Posted by Marco Dinacci on 0 comments

Update: 04 November 2012 - The OpenJDK macosx-port has vastly improved in the last few months and all my patches have been accepted so I no longer recommend this fork.

At my current job I'm tasked with bringing a Java Swing application to the App Store.

The way to do it, on OSX, is to bundle a Java distribution within the application as by Apple's terms it is no longer possible to distribute applications that rely on technologies optionally installed. As such, I started looking how to bundle the OpenJDK inside an OSX application.

It turns out AppBundler does exactly that. So, task finished ? no, not quite...In the process of testing and improving our application I discovered several bugs in the OpenJDK and after a few patches we finally decided to maintain our own branch.

Our OpenJDK fork currently provides:

I hear you say, why forking instead of contributing back the changes ?

I did contribute one patch, but my other contributions weren't accepted for several reasons. apple.awt.fileDialogForDirectories is not going to be supported, so there's no interest in adding it. The univesal build change touches the whole OpenJDK not only the jdk repository, it's been contributed originally by somebody else and it is still currently been discussed. Regarding the JMenuItem fix, the real cause of the problem is still unknown, although my change still fixes the problem and correct an existing error. In general, it is a bit difficult to match our need to move quickly and our interests with the slow process of contributing an official patch and the long-term plans at Oracle.

In addition to the OpenJDK fork, I also forked AppBundler, reason being, my perceived lack of interest in this project at Oracle (although I did submit patches that have been accepted).

Our AppBundler fork features:

  • Universal (32/64) JavaAppLauncher (Java launcher stub)
  • Fixes icon not showing in the dock, linked to bug bug #7159381 in the OpenJDK.
  • Add classpathref support to the bundleapp task.
  • Add support for LSArchitecturePriority key.
  • Allow to specify a custom value for CFBundleVersion instead of the hard-coded "1".
  • Allow specifying registered file extensions using CFBundleDocumentTypes
  • If you're a Java developer trying to bring your app to the Mac App Store, go ahead and download our stable jdk and AppBundler forks. For a slightly more experimental code, feel free to clone my jdk and my AppBundler repos on BitBucket.