Mac之环境配置
#Jdk & Maven & Jmeter
- 1.编辑用户目录下.bash_profile文件
终端输入:vim .bash_profile
- 2.粘贴以下内容后,保存并退出 :wq
Esc输入:wq
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export JAVA_11_HOME=/Library/Java/JavaVirtualMachines/Jdk-11.0.2.jdk/Contents/Home
export JAVA_HOME=$JAVA_8_HOME
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export CLASSPATH
PATH=$JAVA_HOME/bin:$PATH:.
export PATH=${PATH}:/usr/local/mysql/bin
export M2_HOME=/Library/apache-maven-3.5.4
export PATH=$PATH:$M2_HOME/bin
export JMETER_HOME=/Library/apache-jmeter-5.2.1
export PATH=$JAVA_HOME/bin:$PATH:.:$JMETER_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$JMETER_HOME/lib/logkit-2.0.jar
- 3.执行命令,使配置文件生效
source ~/.bash_profile
- 4.执行命令确认,如果成功则会自动开启jmeter窗口
java -version
jmeter
mvn -version
::解释及注意事项::
1.由于我装了两个java 一个8一个11,所以
export JAVA_HOME=$JAVA_8_HOME
的作用是用于切换
2.export PATH 和export CLASS-PATH中java和Jmeter的环境
用 “:”隔开 不能用“;”
3.export PATH 当中只需末尾跟一个“$PATH”即可