Mac版配置JDK环境变量

2021-09-18  本文已影响0人  信仰年輕

1.配置环境变量

1.打开mac终端:command+空格键--弹出搜索框输入terminal.app

2.如果你是第一次配置环境变量,可以使用touch .bash_profile 创建一个.bash_profile的隐藏配置文件(如果你是为编辑已存在的配置文件,则使用open -e .bash_profile命令)

3.输入open -e .bash_profile命令

2.新建配置文件.bash_profile并打开

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME

3.新建配置文件 .zshrc并打开

source ~/.bash_profile

4.命令行刷新配置

source ~/.bash_profile
source ~/.zshrc
上一篇下一篇

猜你喜欢

热点阅读