macOS Java安装与配置

运行环境:

  • macOS Hight Sierra(Version 10.13.6)
  • Terminal(oh my zsh)
  1. 下载安装JRE

Download URL

  1. 下载安装JDK

Download URL

  1. 配置JAVA_HOME

    • 打开Terminal
    • vim .bash_profile
    • export JAVA_HOME=$(/usr/libexec/java_home)
    • source .bash_profile
    • echo $JAVA_HOME
  2. 添加$JAVA_HOME/bin.bash_profile

    • 打开Terminal
    • vim .bash_profile
    • export PATH=${JAVA_HOME}/bin:$PATH
    • source .bash_profile
  3. 完成!