How to Check Java Version on Mac

August 24, 2020

Introduction

Thanks to its cross-platform capabilities and a rich ecosystem of supported libraries and frameworks, Java powers many famous enterprise and consumer-facing applications. Since different applications require different Java versions, knowing which version is set up on the system is necessary when installing a Java-based app.

In this tutorial, learn how to check the Java version on your Mac.

How to check Java version on a Mac.

Prerequisites

How to Check Java Version on Mac

Finding the installed Java version on macOS requires using the command line. Java versions 10 and older also featured the Java Control Panel GUI applet, which showed the installed version in a graphical environment. However, the applet was discontinued as part of the efforts to reduce complexity and simplify the maintenance of Java.

The following sections provide instructions for checking the Java version on macOS.

Option 1: Check Java Version on Mac Using Terminal

Checking the Java version using a terminal emulator in macOS is a simple one-command process. Follow the steps below to see which Java version is installed on the system:

1. Open Spotlight Search by pressing Command + Space on the keyboard.

2. Type Terminal in the search bar and open it by selecting the relevant search result.

Opening Terminal on macOS using Spotlight Search.

3. Execute the following command:

java -version

The output displays the Java version installed on macOS.

java version 22.0.2 installed on macOS

To check the version of the primary Java compiler (javac), use the command below:

javac -version

The command shows the compiler's version in the output.

javac version 22.0.2 installed on macOS

Option 2: Check Older Java Versions on Mac Using GUI

If the system has Java 10 or older, you can check the version using the Java Control Panel in the System Settings. Below are the steps to locate the Java version in the control panel:

1. Open System Settings.

2. Select the Java icon in the menu on the left side. The Java Control Panel opens in a separate window.

Opening the Java control panel on macOS.

3. Find the Java version in the About section of the control panel.

Finding the Java version on macOS from the Java control panel.

Conclusion

This tutorial showed you how to check the version of Java installed on a macOS system. In addition to the standard CLI approach, the article included GUI steps available for older Java versions.

If you are starting with Java development, read our 16 Best Java IDEs article and find the developer environment that suits your needs.

Was this article helpful?
YesNo
Sofija Simic
Sofija Simic is an experienced Technical Writer. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.
Next you should read
How to Install Ruby on Windows 10
July 29, 2020

Ruby is often used in web applications, games, and simple scripts. Follow this simple tutorial and install...
Read more
How to Install Java on Raspberry Pi
July 18, 2024

This article guides you through the Java installation process on Raspberry Pi. You will also learn how to set...
Read more
How to Update Node.js to Latest Version {Linux, Windows, and macOS}
January 31, 2024

If you are a Node.js user, you need to make sure to regularly update the software package as new releases...
Read more
How to Check Python Version in Linux, Mac, & Windows
December 15, 2023

Python is a popular programming language with different versions organized by release date. Certain...
Read more