Download and Install OpenJDK 17 on macOS
- Details
- Written by Nam Ha Minh
- Last Updated on 11 January 2022   |   Print Email
1. Download binary distribution of OpenJDK 17 for macOS
Visit the official download page of OpenJDK 17 at https://jdk.java.net/17, and click on the download link for macOS/x64 if your computer running on Intel’s CPU, or choose macOS/AArch64 for Apple’s CPU:
2. Install OpenJDK 17 on macOS
Next, you need to set JAVA_HOME and update PATH environment variables so other Java programs and tools could find JDK. In the terminal, type the following command to create the Z-Shell resource file:cat > .zshrc
export JAVA_HOME=$HOME/jdk-17.0.1.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
Press Control + D to save the file. The .zshrc file is run whenever a new terminal session is initialized, which sets JAVA_HOME and update PATH environment variables.NOTE: If you’re using Bash shell, create the .bash_profile file instead of .zshrc file.Quit the terminal and start a new session. Then type java -version command, you should see the following output:
Related Articles:
- How to set JAVA_HOME in macOS and Linux permanently
- How to set JAVA_HOME environment variable on Windows 10
- What are JVM, JRE and JDK
- How to write, compile and run a hello world Java program for beginners
- Java Core Language Tutorials
About the Author:

Comments