Installing Java 1.5 on Snow Leopard
Lion Update - July 21, 2011
Details about OS X Lion and Java 1.5 are here.
Important Update - April 11, 2011
BEFORE YOU UPDATE JAVA: If you have a working 1.5 setup already, back up your /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0 directory before you update Java from Software Update, just in case something goes wrong:
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo cp -av 1.5.0 ~/Desktop/.
Then perform the software update. You can use the Java Preferences app to confirm that only Java SE 6 is installed after the update.
Once you have a backup, if the steps in the Original How To below don’t work for whatever reason, you can restore your working 1.5 support:
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm 1.5
sudo rm 1.5.0
sudo cp -av ~/Desktop/1.5.0 ./
sudo ln -s 1.5.0 1.5
Use Java Preferences app to confirm that you have both Java SE 6 and J2SE 5.0 installed.
Original How To, updated for recent versions of Leopard Java:
A few other pages on the web give instructions for installing the Java 1.5 support that is (inexplicably) missing in OS X 10.6.x. Unfortunately they rely on an untrusted gzip file posted on a server at washington.edu that is getting hammered.
Apple really doesn’t want you using Java 1.5 anymore. The instructions below now require editing the Info.plist file that ships with their package. But as of today I have a fully patched Java 1.6.0_24 with a working 1.5.0_28 on Snow Leopard, so it is possible to hack around Apple’s probably sensible but terribly inconvenient lack of support.
Download the official Java package from Apple, “Java for Mac OS X 10.5 Update 9" dated March 8, 2011. Double click the .img file to mount it.
You will need the excellent shareware utility Pacifist to open the included .pkg file.
How to install
1) First use Finder to go to System > Library > Frameworks > JavaVM.framework > Versions and delete the two aliases (symlinks) “1.5” and “1.5.0”. Don’t skip this step, because otherwise the extraction will follow the symlinks and overwrite the contents of the 1.6.0 folder, oops.
2) Use Pacifist to open the JavaForMacOSX10.5Update9.pkg file that you downloaded.
3) In Pacifist, drill down into Contents > System > Library > Frameworks > JavaVM.framework > Versions.
4) In Pacifist, select 1.5 and 1.5.0, right-click, and chose Install to Default Location. Use Administrator Privileges.
5) Now, you will need to edit 1.5.0/Resources/Info.plist in order to allow your system to allow the older Java version to run. In a Terminal window:
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo nano -w 1.5.0/Resources/Info.plist
6) Find the key JVMMaximumFrameworkVersion (use Ctrl-w to find) and update the value to 13.*.*
7) Go to the next key VMMaximumSystemVersion and update the value to 10.6.*
8) Ctrl-x to save the file and exit
9) Use Java Preferences app to verify that you have J2SE 5.0 installed.
Now you can launch Zend Studio 5.5 or whatever else you needed Java 1.5 support for. Enjoy!
(And many thanks to Davey Shafik for pointing me in the right direction with his Fixing ZDE 5.5 in Snow Leopard post.)