Wednesday, July 13, 2011

How to restore Java 1.5 on Snow Leopard

Apple is so annoying. This morning I upgraded my Mac OS (a non-restart-required, supposedly low impact upgrade) and then discovered that my codebase, which requires Java 1.5, would no longer compile in IntelliJ. The upgrade had removed my install of 1.5 and replaced it with a symlink to 1.6. Why does Apple so badly want to force users into Java 1.6? It's extremely irritating to have to stop everything and remind myself how to do this all over again. I looked in here to see if I could find my notes and I could not.

On the command line:
cd /System/Library/Frameworks/JavaVM.framework/Versionssudo rm 1.5sudo rm 1.5.0
Open the file JavaForMacOSX10.5Update6.dmg with Pacifist.

Navigate inside the Pacifist display to /System/Library/Frameworks/JavaVM.framework/Versions.

Select 1.5.0 and Install to Default Location.

On the command line:
sudo ln -s 1.5.0 1.5



Some links:




UTA: I found my notes. In case these provide any additional context.

Restoring Java 1.5.22 to the machine

For some reason Apple saw fit to remove all versions of Java other than 1.6 in Snow Leopard. In the dir /System/Library/Frameworks/JavaVM.framework/Versions there are entries for "1.5" and "1.5.0" but they are symlinks to "CurrentJDK", which itself is a symlink to "1.6". In order to restore Java 1.5.22 I followed the suggestions of this blog page:

http://codethought.com/blog/?p=233

In a nutshell (in case the page goes away) I used Pacifist (http://www.charlessoft.com/) to open the Java for Mac OS X 10.5 Update 6 (http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_6) package, and selected only the 1.5 and 1.5.0 elements for install, rather than running the whole update. Before doing this I had to delete the empty symlinks "1.5" and "1.5.0".

It's possible - the blog author notes that this happened to him - when installing the latest Java update for OS X 10.{?} it will change the frameworks dir and rename the "1.5.0" folder to "1.5.0 1", installing the symlink to "CurrentJDK" in "1.5.0"'s place. If this happens, just jettison the new "1.5.0" and rename "1.5.0 1" back to "1.5.0".

No comments: