Menu Home

OSX切换JAVA版本

OSX 10.9.4

查看当前Java版本

java -version
java 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)

查看系统可用的Java版本

/usr/libexec/java_home -v "1.6*"
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

导出JAVA HOME

export JAVA_HOME=`/usr/libexec/java_home -v '1.6*'`

查看更改后的JAVA版本

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)

Leave a Reply

Your email address will not be published.