EDIT: This no longer works as of 10.6.5 without some additional tweaks. I have to update the post accordingly.

In an amazing moment of WTF I discovered this morning that after installing Mac OS X 10.6 (aka Snow Leopard) that the only version of Java running on it was 1.6. Now as an end-user, people probably won’t care. And I can kind of understand why Apple did it, given that Sun has done and End of Service Life for J2SE 5.0 (also known as Java 1.5). However a bunch of us still use earlier Java versions in active development projects. This was incredibly short-sighted of Apple. I’d guess that the 1.5 version probably exists on Snow Leopard Server Edition, but I’m not interested in paying for the server license when I don’t run OS X servers. However, it’s possible to bring back Java 1.5 onto your Snow Leopard installation. There are a few other pages that explain how to do this but I’ll re-iterate the steps I used here because it uses the most recent J2SE 5.0 release:

Preparation:

First, get Java for Mac OS X 10.5 Update 5 from Apple.

Next get Pacifist from CharlesSoft. This is a great utility. It’s saved my butt a few times. Especially when I needed to get something from an Apple installation package without having to re-run the installer. This qualifies as one of those times. If you don’t already have a registered copy, get one. It’s worth US $20.

How to install.

1. Use Finder to go to System > Library > Frameworks > JavaVM.framework > Versions and delete the two aliases (symlinks) "1.5" and "1.5.0". If you skip this step you will lose your Java 1.6 installation that comes with Snow Leopard. That would be bad. So don’t skip this step!

2. In finder, open JavaForMacOSX10.5Update5.pkg that’s inside JavaForMacOSX10.5Update5.dmg with Pacifist. Drill down to Contents > System > Library > Frameworks > JavaVM.framework > Versions.

3. In Pacifist, select 1.5 and 1.5.0, right-click, and chose Install to Default Location.

You can probably do the same thing with the 1.4 installation if you need it. I didn’t try.. but it would probably work.

Update 12-4-2009:After installing the latest Java update for OS X 10.6 I was greeted with the following change to my Java Frameworks directory. FinderScreenSnapz003.jpg

Apparently the updater saw fit to move my Java installation for 1.5 aside during the update and recreate it’s own aliases/symlinks. If this happens to you follow step one, and rename the 1.5.0 1 folder back to the original name.


Thanks to the following articles from which I borrowed and stole heavily…

chxo internets
oneswarm.org
daveyshafik.com