Installing JDK 7 on Mac OS X
To get JDK 7 up,
- I downloaded the JDK from Oracle. They have a nice dmg file, which makes it easy to install.
- After reading their installation instructions and running /usr/libexec/java_home (which I didn't even know about), it still wasn't defaulting to JDK 7.
/System/Library/Frameworks/JavaVM.framework/VersionsThis 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/ContentsYou'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/HomeSo, 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/ CurrentJDKThen, 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)
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)