【Java】【基本】Mac配置Jdk环境变量

  1. cd ~
  2. vi .bash_profile

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH:
export JAVA_HOME
export CLASSPATH
export PATH

  1. source .bash_profile
  2. 注销
  3. 检查配置是否成功 java -version
  4. cd /etc
  5. sudo vi profile

JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home"
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

  1. echo $JAVA_HOME

你可能感兴趣的:(【Java】【基本】Mac配置Jdk环境变量)