MacOS – Java on Mountain Lion 10.8.2 pitfalls

javamacos

I downloaded the latest version of Java from Oracle site and installed it on my mac.

MacCris:~ cris$ java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

then,

MacCris:/ cris$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions
total 64
lrwxr-xr-x  1 root  wheel   10 Jan  3 20:20 1.4 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Jan  3 20:20 1.4.2 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Jan  3 20:20 1.5 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Jan  3 20:20 1.5.0 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Jan  3 20:20 1.6 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Jan  3 20:20 1.6.0 -> CurrentJDK
drwxr-xr-x  7 root  wheel  238 Jan  3 20:20 A
lrwxr-xr-x  1 root  wheel    1 Jan  3 20:20 Current -> A
lrwxr-xr-x  1 root  wheel   59 Jan  3 20:20 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

going to /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents and executing

MacCris:bin cris$ /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

So the currentJDK is 1.6 despite i installed latest java.

Best Answer

The Oracle Java ie 1.7 does not install itself in the same place as the Apple Java ie <= 1.6.

The java executable is in /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/bin/java

This is possibly because only Apple supplied files should be under /System