Recently I had to switch to newer java version on my Mac. Turns out it is not straight forward so I put together some notes that would help others. Usually java command is located in /usr/bin/java on Mac. This is a symbolic link to java command in one of the java versions installed on your computer. To change your java version. use the following commands.

cd /usr/bin
sudo rm java
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java java

Now try java -version… you should see

java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)

Leave a Reply