https://www.cnblogs.com/c-xiaohai/p/6985018.html
dmg安装包安装 vim ~/.bash_profile_jdk
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
export JAVA_11_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
#alias是设置指令的别名:动态切换JAVA_HOME的配置
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
alias jdk11="export JAVA_HOME=$JAVA_11_HOME"
source ~/.bash_profile_jdk
切换:
jdk8 java -version