This post has been updated, see below
This morning I applied Apple’s Java for Mac Update 2 and discovered that it broke my favorite editor and most-used application, jEdit. Other people seem to be having the same problem but there were few solutions. I found one that involves recreating the Application Bundle using the Java Bundler that ships with the Developer Tools. Here’s how it works:

  1. Backup your original jEdit.app application bundle (I called mine jEdit.orig.app).
  2. Open up jEdit.app (right click and do “Show Package Contents”). Navigate to “Contents” > “Resources” > “Java” and copy the jedit.jar file to your Desktop.
  3. Open up /Developer/Applications/Utilities/Jar Bundler.app.
  4. Next to the text field that says “Main Class” click the “Choose…” button and navigate to the jedit.jar copy that you just made on the Desktop.
  5. Make sure “Use Macintosh Menu Bar” is checked and press the “Create Application Button” at the bottom. Call the application “myJedit” or something else that distinguishes it from the original.
  6. Open up your new jEdit application bundle (“myJedit.app”) using “Show Package Contents” and navigate to Contents/Mac OS. Inside here you should see a file called “JavaApplicationStub.”
  7. Copy “JavaApplicationStub” from your new jEdit bundle (“myJedit”) to the Contents/Mac OS directory in your original jEdit.app bundle.
  8. Inside the original Contents/Mac OS directory you should see an alias called “jedit.” Rename this “jedit.bad” or something similar.
  9. Go one level up in the jEdit.app bundle to “Contents” and open up the “Info.plist” file. This open up using the Property List Editor (it lives in /Developer/Applications/Utilities).
  10. Expand the tree and change the ‘CFBundleExecutable’ string from ‘jedit’ to ‘JavaApplicationLauncher’.

That’s it! Close up the jEdit.app bundle and double click on it. jEdit should start normally as it used to, complete with the Mac Menu bar. Additionally, if you’ve installed the jedit shell script for launching jEdit from the terminal that should still work as well.

It’s not the prettiest solution but it keeps me going for now until a better fix is released.

UPDATE:
Someone in the Apple forums pointed out that simply copying the destination of the jEdit.app/Contents/MacOS/jedit symlink, which points to

/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/MacOS/JavaApplicationStub

back into jEdit.app/Contents/MacOS/jedit (replacing the symlink with a copy) also makes the jEdit application bundle work again. This method has considerably fewer steps than mine.

Apparently this file is functionally the same as the one generated by Jar builder. It seems Java developers went for the symlink method specifically to avoid problems created whenever Apple would go and update Java. With this update the symlink doesn’t seem to work again.

Java for Mac Update 2 leaves some Java Apps broken
Tagged on:         

One thought on “Java for Mac Update 2 leaves some Java Apps broken

Leave a Reply