mac安装两个jdk,怎样切换版本?
http://www.oschina.net/question/1050447_2151299
http://www.jianshu.com/p/951dd7f8139a
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
export JAVA_7_HOME=`/usr/libexec/java_home -v 1.7`
export JAVA_8_HOME=`/usr/libexec/java_home -v 1.8`
export JAVA_HOME=$JAVA_7_HOME
alias jdk7="export JAVA_HOME=$JAVA_7_HOME"
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
我的.bash_profile文件,手动切换
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
#配置alias方式切换jdk1.7和jdk1.8
export JAVA_7_HOME=`/usr/libexec/java_home -v 1.7`
export JAVA_8_HOME=`/usr/libexec/java_home -v 1.8`
export JAVA_HOME=$JAVA_8_HOME
alias jdk7="export JAVA_HOME=$JAVA_7_HOME"
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
export GRADLE_HOME=/usr/local/gradle-2.12
export M2_HOME=/Users/kokia_web/apache-maven-3.3.9
export MYSQL_HOME=/usr/local/mysql
export PATH=$JAVA_HOME/bin:$GRADLE_HOME/bin:$M2_HOME/bin:$MYSQL_HOME/bin:$PATH: