Java – Install java 1.5 sdk on Mac OS 10.7

javamacososx-lion

Mac OS 10.7 (Lion) comes with JDK 1.6 and java 6. Is it feasible to install 1.5 as well so the two can co-exist?

Would you just install the JDK in /System/Library/Frameworks/JavaVM.framework/Versions and then update the symlink to 1.5 so it points to the correct version instead of the default 1.6 (latest)?

Then update the JAVA_HOME environment variable accordingly?

Best Answer

I've been following the links and script on this website to install it on Mac OS 10.7.5 64-bit, and it's been working fine except when I install Apple Java Security updates, which seem to make my JDK terminate on startup without any notifications.

Reinstalling it has been fixing the issue.

I also use a simple Bash script to change the JAVA_HOME to the JDK 1.5 location, when I need to switch from 1.6 to 1.5.