mac jdk多版本+maven配置

单版本配置

 

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 

 

 

posted @ 2023-07-17 18:44  风吹一点云  阅读(365)  评论(0编辑  收藏  举报