Common Folk Collective » coding http://commonfolkcollective.com/blog Common Folk Doing Uncommon Things Tue, 15 Mar 2016 17:08:24 +0000 en-US hourly 1 http://wordpress.org/?v=3.9 Using both Java 1.7 and 1.6 on Mountain Lion http://commonfolkcollective.com/blog/2013/04/using-both-java-1-7-and-1-6-on-mountain-lion/?utm_source=rss&utm_medium=rss&utm_campaign=using-both-java-1-7-and-1-6-on-mountain-lion http://commonfolkcollective.com/blog/2013/04/using-both-java-1-7-and-1-6-on-mountain-lion/#comments Wed, 24 Apr 2013 14:46:43 +0000 http://commonfolkcollective.com/blog/?p=3597 Here’s the situation you need to use both JDK 1.7 and JDK 1.6 for different projects you are working on with Mac OS X. You already have Java 1.6 installed and ran the installer for Java 1.7 from Oracle but no matter what you do java -version will only show 1.6.

Here’s what you do to use 1.7 run the following:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

To use 1.6 run the following:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

Note you may have to adjust for the exact version for example if you installed jdk1.7.0_12.jdk.

Here’s an example:
thor:~ dan$ sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)
thor:~ dan$ sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
thor:~ dan$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Share

]]>
http://commonfolkcollective.com/blog/2013/04/using-both-java-1-7-and-1-6-on-mountain-lion/feed/ 0