How to install JDK on Mac

1. Access to the Oracle’s website, find the JDK download location www.oracle.com/java/techno…

2. Click the “JDK DOWNLOAD” button:

After downloading, click the installation package and complete the installation as prompted.

3. Configure environment variables

Export JAVA_HOME = / Library/Java/JavaVirtualMachines jdk1.8.0 _281. JDK/Contents/HomeCopy the code

Mac executes environment variables configured by source /etc/profile each time to take effect

However, the configuration does not take effect after each terminal restart. ZSHRC file is loaded by ZSH, and the ‘.zshrc ‘file does not define the task environment variables. Add source /etc/profile at the end of the /etc/zshrc file

Configuration examples: