Installing Java on MacOS

To install Java on a Mac, you can follow these steps:

  1. Open a web browser and visit the official Oracle Java website at https://www.oracle.com/java/technologies/downloads/archive.
  2. Look for Java SE downloads list. From that list, select the Java version that you wish to download.
  3. Find macOS x64 DMG Installer (.dmg) file and click on the download link.
  4. Next, review and accept the Oracle Technology Network License Agreement for Oracle Java SE and then click on the download button.
  5. You'll be redirected to the oracle login page. Sign-in into your Oracle account. When the download dialog box appears prompting you to run or save the file, choose to save the file to install it later.
  6. Once the download is complete, open the .dmg file by double-clicking on it.
  7. A new window will open with the JDK installer package. Double-click on the package file (.pkg) to start the installation.
  8. Follow the on-screen instructions to complete the JDK installation process. You may need to provide your macOS system password during the installation.
  9. After the installation is completed, you can verify if the JDK is installed correctly. To do this, open the Terminal. Type java -version and press Enter. It should display the installed Java version information as shown in the example below:
java version "17.0.2_231"
Java(TM) SE Runtime Environment (build 17.0.2_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

Congratulations, you have successfully downloaded and installed the JDK on your Mac. You can now start using Java for development purposes.