Android 切换jdk on Mac OS

来源:互联网 发布:山西太原理工软件学院 编辑:程序博客网 时间:2024/06/11 01:06

请参考: http://superuser.com/questions/650310/switching-between-java-7-and-8-in-os-x

1) Install all of them, 1.6, 1.7, 1.8 in any order. I believe the last one installed determines which one will be used for browser plugins, I'm not going to care about changing those below.

2) Then, add to your bashrc or wherever:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)setjdk() {  export JAVA_HOME=$(/usr/libexec/java_home -v $1)}

Now you can:

$ java -versionjava version "1.7.0_51"Java(TM) SE Runtime Environment (build 1.7.0_51-b13)Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)$ setjdk 1.6$ java -versionjava version "1.6.0_65"Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)$ setjdk 1.8$ java -versionjava version "1.8.0"Java(TM) SE Runtime Environment (build 1.8.0-b132)Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

Obviously the change is only for the duration of the shell. But you can see where you can set it globally now.


0 0
原创粉丝点击