标签:
新装的mac 系统10.10 ,jdk是1.8,因为一些工具要使用 jdk 6,以下是设置过程
查看版本
java -version
查看java是再哪:在/usr/bin/java
whereis java
cd /usr/bin ls -all | grep java lrwxr-xr-x 1 root wheel 74 9 23 00:23 java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java lrwxr-xr-x 1 root wheel 75 9 23 00:23 javac -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac lrwxr-xr-x 1 root wheel 77 9 23 00:23 javadoc -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javadoc lrwxr-xr-x 1 root wheel 75 9 23 00:23 javah -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javah lrwxr-xr-x 1 root wheel 75 9 23 00:23 javap -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javap lrwxr-xr-x 1 root wheel 76 9 23 00:23 javaws -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaws
都是软链接
cd /System/Library/Frameworks/JavaVM.framework/Versions/
ls -all drwxr-xr-x 11 root wheel 374 9 23 00:23 . drwxr-xr-x 11 root wheel 374 9 23 00:23 .. lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.4 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.4.2 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.5 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.5.0 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.6 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.6.0 -> CurrentJDK drwxr-xr-x 7 root wheel 238 9 23 00:23 A lrwxr-xr-x 1 root wheel 1 9 23 00:23 Current -> A lrwxr-xr-x 1 root wheel 59 9 23 00:23 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
Current 指向了A,A是1.8的
我自己安装的1.6 在CurrentJDK,删除以前的软链接,执行CurrentJDK,就Ok了,如果要还原到1.8 就重新建立软链接
sudo rm -rf Current ln -s CurrentJDK Current ls -all total 64 drwxr-xr-x 11 root wheel 374 9 23 00:32 . drwxr-xr-x 11 root wheel 374 9 23 00:23 .. lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.4 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.4.2 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.5 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.5.0 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.6 -> CurrentJDK lrwxr-xr-x 1 root wheel 10 9 23 00:23 1.6.0 -> CurrentJDK drwxr-xr-x 7 root wheel 238 9 23 00:23 A lrwxr-xr-x 1 root wheel 10 9 23 00:32 Current -> CurrentJDK lrwxr-xr-x 1 root wheel 59 9 23 00:23 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Mac JDK 1.6 安装 :是否有毒,自行判断,因为xcodeGoast,心里有点怕怕的。
http://download.csdn.net/download/zw_yuyan/8350587
标签:
原文地址:http://www.cnblogs.com/likwo/p/4831019.html