環境:Mac系統、jdk1.8、maven3.8.4
終端輸入mvn -v出現:
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
解決方法:
修改環境變量
- 終端打開~/.bash_profile
vim ~/.bash_profile
- 添加
export JAVA_HOME=$(/usr/libexec/java_home)
- 修改配置前:
- 修改配置后:
- 更新~/.bash_profile
source ~/.bash_profile