Install the JDK
Because Java programs must run on the JVM, so the first thing we do is install the JDK.
Search JDK 13, to ensure that from Oracle's official website JDK download the latest stable version:
Java SE 13.x find the download link and choose macOS system version, you can download and install.
Set Environment Variables
After installing, installed by default in the following path:
/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
Use vim edit a configuration file ~ / .bash_profile, add the following to the file:
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home"
Then, the JAVA_HOME bin directory to the system environment variable PATH, save and exit:
export PATH=$JAVA_HOME/bin:$PATH
Use the source command to update it, to validate the configuration:
source ~/.bash_profile