MacOSX的JDK版本快捷切换

修改.bash_profile


# JDK8
 
export JAVA_8_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home'
 
# JDK12

export JAVA_12_HOME='/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home'

# JDK7

export JAVA_7_HOME='/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home'

export JAVA_HOME=$JAVA_8_HOME

alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
 
alias jdk12="export JAVA_HOME=$JAVA_12_HOME"

alias jdk7="export JAVA_HOME=$JAVA_7_HOME"


配置生效

source .bash_profile

切换命令

jdk8
posted @ 2019-10-31 11:09  lowezheng  阅读(489)  评论(0编辑  收藏  举报