此为 mac 上的:常用的 java、android sdk 环境配置路内容,mac 上经常写在配置文件中.bash_profile等
首先创建打开
.bash_profile,已有.bash_profile可直接执行open -e .bash_profile
####创建保存编辑生效文件
//创建或编辑文件.bash_profile
//创建编辑.zshrc同样方式
touch .bash_profile
//打开文件.bash_profile,
///打开后把下面的环境配置路径核对好自己的路径,复制粘贴进去,command+s 保存。
open -e .bash_profile
//使编辑保存过的.bash_profile生效,
///保存完需执行一下 source 即可生效
source .bash_profile
如果每次打开终端环境变量都不生效,如出现zsh: command not found: adb,可以试着创建.zshrc.
在.zshrc文件中添加一句:source ~/.bash_profile,保存,命令行语句与.bash_profile基本一样,如下:
touch .zshrc
open -e .zshrc
source .zshrc
重新打开终端就直接加载了。
常见环境变量内容:
- java
# Seting PATH for JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
export JAVA_HOME=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
- Android
# Setting PATH for ANDROID_HOME
export ANDROID_HOME=/Users/nhl/Library/Android/sdk
export PATH=$ANDROID_HOME/emulator:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/build-tools/29.0.3:$PATH
- JMeter
# JMeter 添加环境变量 路径
export JMETER_HOME=/Applications/apache-jmeter-5.6.3
export PATH=$JMETER_HOME/bin:$PATH
- flutter
# 添加flutter sdk下面bin目录到相关工具path中去。
export FLUTTER_HOME=/Users/nhl/Library/flutter
export PATH=$PATH:$FLUTTER_HOME/bin
export PATH=$PATH:$FLUTTER_HOME/bin/cache/dart-sdk/bin
# flutter环境变量
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn












网友评论