In this article, I will guide you how to setup Java runtime environment on macOS operating system with Oracle JDK version 19, step by step.

You know, Oracle JDK is a commercial build of Java Development Kit (JDK) and you can use it for personal, development and production use. Organizations and businesses should pay for Java SE subscription.

JDK 19 was released on September 20th 2022. It’s a regular update, not Long Term Support (LTS) release of Java SE platform.

 

1. Download DMG Installer for Oracle JDK 19

Oracle JDK is distributed in both compressed archive and installer. I recommend you to download DMG installer for macOS for the ease of setup.

Head over to the official Oracle JDK download page, you should see the following page:

jdk 19 download page macos

You can see, there are 2 links for DMG installer (x64 and Arm64). Which one to choose depends on your Mac’s CPU architecture.

  • If your Mac has Intel CPU, download the x64 DMG Installer
  • Else if your Mac has Apple chip, download the Arm 64 DMG Installer (link number 1)

And it’s strongly recommended to verify the SHA256b checksum of the downloaded file. Open a Terminal window, change the current directory to the location of the downloaded file, and type:

shasum -a 256 jdk-19_macos-aarch64_bin.dmg

Compare the output of this command against the value published on the download page (link number 2). If both are identical, it’s safe to proceed.


2. Install Oracle JDK 19 on macOS

To install Oracle JDK 19, double click the .dmg file. It will extract to JDK 19.0.1.pkg package. Then double click the package icon to launch the installer. You should see the JDK installer program appears:

oraclek jdk 19 installer on macos

Just click Continue to start installation process. It will be quick and easy. And when it’s done, click Close to quit the installer. And click Move to Trash when you’re asked to move the installer to trash.

By default, Oracle JDK 19 will be installed in /Library/Java/JavaVirtualMachines/jdk-19.0.1.jdk directory.

Note that using DMG installer, it puts java and javac programs under /usr/bin directory which is included in the PATH environment variable. So you don’t have to configure system environment variable, just type java -version and javac -version in the terminal to check:

check oracle jdk 19 macos

If you see this output, that means Oracle JDK 19 has been installed successfully on your macOS. I recommend you to watch the following video to see the setup in action:

 

Related Articles:


About the Author:

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.

Add comment