Installing Java SDK 7 on Mac OS X

Since today i started to work as a Team Lead in a new cool company Portavita . As a result, i got a new nice working laptop - Macbook Pro ( can't imagine myself working by anything except apple computers:) ), which i had to setup from scratch, as usual:) And so, you know how they say - the best way to forget your password is to let browser save it for you:) So, when i came to installing Java properly, i faced with a problem that there's some tricky hacks still need to be done to make Mac OS X work with Java SDK 1.7. At first, i thought that i just need to download JDK package from Oracle and install it. But, when i ran

java -version

Mac OS X was still thinking that it should use Java 1.6 as a default JVM.
Even after running

/usr/libexec/java_home

i still wasn't able to make java 1.7 as a default one. After some googling i came up to this article . The layout of the article itself is really messed up, but i decided to keep it for myself and make it look nicer :) . So, here's what you need to do :

  • First you download JDK installer from Oracle
  • Then you open terminal and do next :
cd /System/Library/Frameworks/JavaVM.framework/Versions

sudo rm CurrentJDK

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/ CurrentJDK
  • Restart your terminal, and if you did everything properly, you'll see :
java -version

java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)