How to Install Java on Mac

James Gosling developed Java in 1995 at Sun Microsystems. It is a secure, efficient, and easy-to-learn object-oriented programming language. Java is platform-independent as the code is written once and runs anywhere. The most recent version of Java is Java 17, and this Long Term Supported (LTS) release will be supported until 2029.

This blog will explain how to install Java on Mac. Let’s start!

System Requirements

Your Mac system must fulfill the below-given system requirements for Java installation:

  • For Java installation, the logged-in user must have administrator privileges.
  • Java 7 and later versions such as Java 17 require an Intel-based Mac running Mac OS X 10.7.3 or above as their Operating System.

How to Install Java on Mac?

This section will teach the procedure of installing Java 17 on Mac. Here, the question arises why we have selected Java 17 over other LTS releases? To install and execute any Java-based application, you must have Java 17 installed on your system. That’s the reason for selecting Java 17.

There are some steps that need to be followed to install Java on Mac.

Step 1: Download Java 17 Installer File

To install Java 17 on Mac, firstly, visit the official website, click on “Download Java”:

A new page will open, click on green button to begin downloading:

Step 2: Install Java 17

Open up the folder where the downloaded installer file is saved. Find the JRE package in the opened folder and click on it:

Java Installer dialog box will open on your system, click on “Install” button:

The installation will begin:

As you can see, we have successfully installed Java on our Mac system, click “Close” button:

Step 3: Set Java PATH on Mac

The most important step after installing Java on Mac is setting the PATH variable value. For this, execute the below command to get the Java PATH:

% which java

Set the value of the PATH variable of Java by using the following “export” command:

% export JAVA_HOME=/Library/Java/Home

Step 4: Verify PATH Variable Value

Lastly, confirm the PATH variable value:

% echo $JAVA_HOME

That’s it! Java is successfully installed and can run Java-based applications without any hassle.

How to Find Which Version of Java is Installed on Mac?

Mac OS X 10.6 and the lower versions have pre-installed Java in it. While Mac OS X 10.7 and higher versions need to install Java manually. If you want to determine the installed version of Java on your MacOS, check it out using:

Let’s try both of them!

Method 1: Find out Java Version using System Preferences

If you have installed Java 7 or higher version on your Mac, then after installation, open “System Preferences”, and click on the “Java” icon:

As a result, “Java Control Panel” will open up on your screen:

Method 2: Find out Java Version using Mac Terminal

By using the terminal, you can also find the version of the installed Java. To do so, open the terminal on Mac and execute the provided command:

% java -version

We compiled all essential information regarding Java installation on Mac.


On Mac, Java is installed by downloading a dmg file from Java’s website. There are some system requirements for Mac to install Java, such as administrative privileges and a 64-bit browser. Java 7 and later versions, including Java 17 require an Intel-based Mac running Mac OS X 10.7.3 or later. In this blog, we explained the detailed procedure to install Java on Mac and checked its version using System Preferences and Mac terminal.

About the author

Farah Batool

I completed my master's degree in computer science. I am an academic researcher and love to learn and write about new technologies. I am passionate about writing and sharing my experience with the world.