配置JDK
touch .bash_profile
open -e .bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
3.open -e .bash_profile
- 马上生效,输入 source /etc/profile
4.java -version
效果如下
java version “1.8.0_212”
Java™ SE Runtime Environment (build 1.8.0_212-b10)
Java HotSpot™ 64-Bit Server VM (build 25.212-b10, mixed mode)
配置maven
vim ~/.bash_profile
export MAVEN_HOME=/Users/helen/develop/apache-maven-3.6.3
export PATH=$PATH:$MAVEN_HOME/bin
source .bash_profile
mvn -v
查看效果
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/helen/develop/apache-maven-3.6.3
Java version: 1.8.0_212, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"