单版本配置
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home M2_HOME=/Users/lilun/Documents/apache-maven-3.8.6 PATH=$JAVA_HOME/bin:$PATH:. PATH=$M2_HOME/bin:$PATH export M2_HOME export PATH export CLASSPATH alias jdk8="export JAVA_HOME=$JAVA_HOME"
多版本配置
open -e .bash_profile
# 多版本JDK 配置 export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home export JAVA_17_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home M2_HOME=/Users/lilun/Documents/apache-maven-3.8.6 PATH=$JAVA_HOME/bin:$PATH CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar export JAVA_HOME=$JAVA_8_HOME # alias命令动态切换JDK版本 alias jdk8="export JAVA_HOME=$JAVA_8_HOME" alias jdk17="export JAVA_HOME=$JAVA_17_HOME" export PATH PATH=$M2_HOME/bin:$PATH export M2_HOME export CLASSPATH
open -e .zshrc
source ~/.bash_profile
source ~/.bash_profile
source ~/.zshrc
标签:JAVA,jdk,M2,maven,mac,export,PATH,HOME From: https://www.cnblogs.com/li-lun/p/17560928.html