Installing Java 5 Back On Snow Leopard
Installing Java 5 Back On Snow Leopard
x)
Mauricio Hiroshi Nagaoka - 21-Nov-2009
I was trying to build Jetty examples in order to enable Servlet 2.5 annotation processing on
Jetty Maven 2 plugin and found out that these examples require Java 5 to build (JDBC
classes) and Snow Leopard simply doesn't have it.
$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions/
total 48
lrwxr-xr-x 1 root wheel 5 Oct 23 16:51 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Jul 20 20:35 1.3.1
lrwxr-xr-x 1 root wheel 10 Oct 23 16:51 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Oct 23 16:51 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 5 Oct 23 16:51 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 Oct 29 10:39 1.6.0
drwxr-xr-x 9 root wheel 306 Oct 29 10:39 A
lrwxr-xr-x 1 root wheel 1 Oct 23 16:51 Current -> A
lrwxr-xr-x 1 root wheel 3 Nov 21 12:17 CurrentJDK -> 1.6
This "how-to" is based on chxo internets', but uses unpkg instead of Pacifist to extract the
pkg file and a newer Java update.
First, a disclaimer: do it at you own risk. Don't blame me if you mess up your computer. :p
$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ ls -l 1.5 1.5.0
lrwxr-xr-x 1 root wheel 10 Nov 21 13:57 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Nov 21 13:57 1.5.0 -> CurrentJDK
$ sudo rm 1.5 1.5.0
$ sudo mv ~/Desktop/JavaForMacOSX10.5Update5/System/Library/Frameworks/
JavaVM.framework/Versions/1.5.0 /System/Library/Frameworks/JavaVM.framework/
Versions/1.5.0
$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ sudo ln -s 1.5.0 1.5
$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions
total 40
lrwxr-xr-x 1 root wheel 5 Oct 23 16:51 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Jul 20 20:35 1.3.1
lrwxr-xr-x 1 root wheel 5 Nov 21 14:08 1.5 -> 1.5.0
drwxr-xr-x 8 root wheel 272 Nov 21 13:53 1.5.0
lrwxr-xr-x 1 root wheel 5 Oct 23 16:51 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 Oct 29 10:39 1.6.0
drwxr-xr-x 9 root wheel 306 Oct 29 10:39 A
lrwxr-xr-x 1 root wheel 1 Oct 23 16:51 Current -> A
lrwxr-xr-x 1 root wheel 3 Nov 21 13:56 CurrentJDK -> 1.6
#!/bin/sh
cd /System/Library/Frameworks/JavaVM.framework/Versions
CURJDK="`readlink CurrentJDK`"
echo Current JDK version: $CURJDK
echo You must now enter your Mac OS X password to change the JDK.
sudo ln -fhsv $1 CurrentJDK