Wednesday, November 21, 2012

Installing JDK 7 on Mac OS X


To get JDK 7 up,
Surgery required.  So, I headed over to:
/System/Library/Frameworks/JavaVM.framework/Versions
This is where the system jvm's are stored.  You'll notice a symbolic link for CurrentJDK.  It probably points to:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
You're going to want to point that to the new JDK, which java_home tells us is located in:
bone@zen:/usr/libexec$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home
So, the magic commands you need are:
bone@zen:/System/Library/Frameworks/JavaVM.framework/Versions$ sudo rm CurrentJDK
bone@zen:/System/Library/Frameworks/JavaVM.framework/Versions$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/ CurrentJDK
Then, you should be good:
bone@zen:/System/Library/Frameworks/JavaVM.framework/Versions$ java -version 
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

7 comments:

Kirk True said...

Just pulled the latest Cassandra to get back into hacking it and noticed it's using JDK 7. Thanks for getting me unstuck. Thanks!

João said...

Thanks! It solved my maven issue! ;)

mahasiswa teladan said...

hi...Im student from Informatics engineering nice article,
thanks for sharing :)

sarah taylor said...

Thanks for sharing such informative article on Java technology. It is most preferred technology among developers to create stunning mobile application fast and easy. It also created massive career opportunity for aspiring professionals. JAVA J2EE Training in Chennai

john son said...

Your posts is really helpful for me.Thanks for your wonderful post. I am very happy to read your post. It is really very helpful for us and I have gathered some important information from this blog.

Best JAVA Training Institute in Chennai

yuvaraj v said...

Thanks for getting me unstuck. Thanks!hadooptrainingchennai..Very awesome blogs!!!

Michael Chen said...

Thanks. java_home was the command I needed to figure out the library path :-0