How To Install Java 14 On Mac

By bhagwatchouhan
How To Install Java 14 On Mac

In this tutorial, we will discuss how to install Oracle Java 14 on Mac systems. It provides the steps required to install Java 14 on macOS Catalina. The steps should be the same for other versions of macOS including Sierra, High Sierra, and Mojave.

 

System Checks

In this step, we will test whether Java is already installed or not. To do so, open the terminal and type java -version as shown in Fig 1. It shows that Java is already installed on my system.

Java 14 - Mac - System Check

Fig 1

Now press the OK Button to hide the dialog. It might show the message - "No Java runtime present, requesting install" in absence of Java and also opens a dialog to know more about it as shown in Fig 2.

Java 14 - Mac - System Check

Fig 2

 

Download Java 14

Open the download link to select the available versions as shown in Fig 3. Also, go through the new Oracle JDK License started since April 16, 2019.

Java 14 - Mac - Downloads

Fig 3

Click the Download Option as highlighted in Fig 3. It will ask to accept the License Agreement before starting the download as shown in Fig 4 and Fig 5. It might also ask to login to Oracle before starting the download.

Java 14 - Mac - License

Fig 4

Java 14 - Mac - Download

Fig 5

 

Install Java 14

Double click the DMG file downloaded in the previous step to start installing Oracle JDK 14 on Mac. It will mount the DMG disk and shows the installer as shown in Fig 6 and Fig 7. Make sure that you have gone through the updated License Agreement of Oracle JDK.

Java 14 - Mac - Mount

Fig 6

Java 14 - Mac - Installer

Fig 7

Now double-click the installer to start installing Java 14 on Mac. The installer shows the Welcome Screen as shown in Fig 8.

Java 14 - Mac - Install - Welcome

Fig 8

Click the Continue Button to start the installation. It provides options to choose the installation type as shown in Fig 9.

Java 14 - Mac - Install - Type

Fig 9

You may change the installation location by clicking the Go Back Button. It did not allow me to change the installation location on macOS Catalina. Now click the Install Button to start installing Java 14 on Mac. It also asks for permission to complete the installation as shown in Fig 10.

Java 14 - Mac - Install - Permission

Fig 10

It shows the success message after completing the installation as shown in Fig 11.

Java 14 - Mac - Installed

Fig 11

Now unmount the DMG image by right-clicking it as shown in Fig 12.

Java 14 - Mac - Unmount

Fig 12

We can check the JDK version to confirm the installation as shown in Fig 13.

Java 14 - Mac - System Check

Fig 13

This is all about installing Oracle JDK 14 on Mac systems including macOS Sierra, High Sierra, Mojave, and Catalina.

 

Switch JDK

It might be required to switch the active Java in case multiple JDKs are installed on the same Mac machine. You can follow How To Switch Java Version On Mac.

 

Getting started with Java - Hello World

In this step, we will write, compile, and execute our first program in Java using the standard Hello World example.

Now write the first Java program as shown below, save the program as HelloWorld.java and exit the editor. Make sure that the class name and file name are the same.

class HelloWorld {
public static void main( String[] args ) {
System.out.println( "Hello World !!" ); } }

Now open the command prompt and navigate to the path where you have saved your Java program. Use the below-mentioned commands to compile and execute the program.

# Compile - Specify file name and extension
javac HelloWorld.java
# Execute - Spicy file name java HelloWorld
# Output Hello World !!

These are the easy to install steps required to install Oracle JDK on Mac and write, compile and execute the first Java program.

 

Summary

This tutorial provided all the steps required to install Oracle JDK 14 on Mac and also provided the steps required to compile and run the first Java program using a simple Hello World program.

Share this blog:

Profile picture for user bhagwatchouhan
bhagwatchouhan