mac 配置jdk,maven环境变量
Java和maven环境变量配置:
1.打开终端:输入命令:vi ~/.bash_profile
2.再输入 i 进入编辑模式
输入以下:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
export M2_HOME=/Users/hang/Library/apache-maven-3.2.5
export PATH=$PATH:$M2_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH:
export JAVA_HOME
export CLASSPATH
export PATH
3.按esc 再输入shift:+ wq保存退出编辑。
4.输入 source ~/.bash_profile 保存
5.输入 echo $JAVA_HOME 查看路径
/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
6. 输入mvn -v 查看 maven
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)
Maven home: /Users/hang/Library/apache-maven-3.2.5
Java version: 1.8.0_201, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.3", arch: "x86_64", family: "mac"