修改mac系统java版本设置(10.8以后)

1> 打开终端:cd /System/Library/Frameworks/JavaVM.framework/Versions/

   

ls -l

total 64

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.4 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.4.2 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.5 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.5.0 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.6 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.6.0 -> CurrentJDK

drwxr-xr-x  8 root  wheel  272 11  4  2013 A

lrwxr-xr-x  1 root  wheel    1 10 23  2013 Current -> A

 

lrwxr-xr-x  1 root  wheel   59 10 23  2013 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

 

可以看到 CurrentJDK 链接的是 jdk 1.6  

 

2> 安装 jdk7 后的路径:/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk

 

3> 移除CurrentJDK

 

sudo rm CurrentJDK

 

4> 重新链接

 

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/ CurrentJDK

 

5> 重新查看

cd /System/Library/Frameworks/JavaVM.framework/Versions/

   ls -l

total 64

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.4 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.4.2 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.5 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.5.0 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.6 -> CurrentJDK

lrwxr-xr-x  1 root  wheel   10 10 23  2013 1.6.0 -> CurrentJDK

drwxr-xr-x  8 root  wheel  272 11  4  2013 A

lrwxr-xr-x  1 root  wheel    1 10 23  2013 Current -> A

lrwxr-xr-x  1 root  wheel   59  5 13 18:37 CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/

 

6> java -version

java version "1.7.0_25"

Java(TM) SE Runtime Environment (build 1.7.0_25-b15)

Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

 

7>如果安装了mvn

mvn -version

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)

Maven home: /usr/local/Cellar/maven30/3.0.5/libexec

Java version: 1.7.0_25, vendor: Oracle Corporation

Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre

Default locale: zh_CN, platform encoding: UTF-8

 

OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"

 

ok

你可能感兴趣的:(mac java jdk 版本)