- 终端输入
open -n ~/.bash_profile
#jdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#android sdk
export ANDROID_HOME=/Volumes/data/android-sdk-macosx
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
#maven
export MAVEN_HOME=/Users/mac/apache-maven-3.6.0
export PATH=$MAVEN_HOME/bin:$PATH
-
编辑完保存并退出
-
输入
source ~/.bash_profile
使环境变量生效。 -
输入
java -version
查看 JDK 否安装成功。 -
输入
adb --version
查看 SDK 否安装成功。 -
输入
mvn -v
查看 Maven 否安装成功。
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: /Users/mac/apache-maven-3.6.0
Java version: 1.8.0, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"
网友评论