If your Mac computer running on Intel’s CPU, choose the download for x64 DMG Installer. Else choose ARM64 DMG Installer for Mac running on Apple’s CPU.In my case, I’m using iMac with Apple M1 chip, so I click the link 1 for downloading DMG installer for Oracle JDK 20. It will download the jdk-20_macos-aarch64_bin.dmg file.And it’s strongly recommended to check SHA256 checksum of the downloaded archive file to make sure it is safe to use (not tampered with). Open a new Terminal window. Change the current directory to location of the downloaded file, then type the following command:shasum -a 256 jdk-20_macos-aarch64_bin.dmg
Click Continue and Install to start the installation. It should take just a few seconds. Then click Close to quit the installer. When you’re asked to move the installer to trash, let agree.Oracle JDK 20 will be installed in the /Library/Java/JavaVirtualMachines/jdk-20.0.1.jdk directory. And it also puts java and javac programs under /usr/bin directory which is included in the PATH environment variable by default. So you don’t have to manually set JAVA_HOME.Finally, type java -version and javac -version in the terminal to verify. You should see the following output:
That means you have successfully installed Oracle JDK 20 on Mac computer. You can now begin running and developing Java applications on macOS operating system. You can also watch the following video to see the steps in action:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.