echo $SHELL
/bin/bash
为bash, 环境变量配置文件为~/.bash_profile
/bin/zsh
为zsh, 配置文件为~/.zshrc
/usr/libexec/java_home -V
查看本机所有jdkvim ~/.zshrc
:
export JAVA_HOME=$JAVA_8_HOME
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source ~/.zshrc
vim ~/.zshrc
添加:
# maven
export M3_HOME=/Users/songmengjiao/Desktop/tool/apache-maven-3.5.0
export M3=$M3_HOME/bin
export PATH=$M3:$PATH
source ~/.zshrc
mvn -v
显示版本信息M3_HOME/conf/settings.xml
下<localRepository></localRepository>
到制定目录.配置vim ~/.zshrc
# tomcat
CATALINA_HOME=/Users/songmengjiao/Desktop/tool/apache-tomcat-9.0.0.M26
CATALINA_BASE=$CATALINA_HOME
source ~/.zshrc
http://www.codingpedia.org/ama/how-to-prepare-the-macbook-pro-for-java-development-and-more/