• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us

How to Check Java Version? Windows | Mac | Linux

March 8, 2024 //  by Anees Asghar

Java is a popularly used, multi-purpose programming language that is used in various fields of life. Many applications are dependent on Java and require its installation as a prerequisite to work properly. Also, Java releases updates regularly to facilitate its users with new features/updates and fix bugs/errors. Therefore checking which Java version is running on your machine helps you manage your Java-dependent applications efficiently.

This blog post will illustrate several methods to check the Java version on different platforms like Windows, Mac, and Linux.

Checking Java Version on Windows

You can use the (CLI) or (GUI) to check which Java version is running/installed on your Windows operating system. 

Checking Java Version Using Windows CLI | CMD or PowerShell

Open the Command Prompt or PowerShell terminal, type “java –version”, and hit the Enter key to find the Java version installed on your Windows:

java --version

Checking Java Version Using Windows GUI | About Java

Navigate to the Windows start menu, type “About Java”, and click on it to find which Java version you are currently using:

As soon as you click the “About Java” app, the following dialog box pops up, which shows the Java version details:

The above snippet shows that Java 8 is installed on our Windows system, which is the latest Java version (at the time of writing).

Alternatively, open the control panel, and navigate to the “Programs”:

If Java is installed on your system, then the “Java” application will be visible in the “Programs” folder, as follows:

When you click on the “Java” application, the “Java Control Panel” opens. Click the “About..” button to find/check the Java version: 

There you go! The output illustrates that Java 8 is installed on the Windows system:

Checking Java Version on Mac

Mac supports both GUI and CLI-based methods to check the Java version. This section illustrates both methods with appropriate steps and screenshots. You can follow any of the mentioned methods according to your preferences.

Checking Java Version Using Mac Terminal

Execute the given command to check/find the Java version on Mac using the terminal:

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version

The following snippet demonstrates that we have successfully installed Java “1.8.0_351” on our MacBook:

Important: You can determine the JDK version installed on your macOS by executing the following command:

java --version

Checking Java Version Using Mac GUI | System Preferences

To check the Java version using Mac GUI, open the menu bar and navigate to the “System Preferences…”:

Scroll down to find the “Java” application; click on it to open the “Java Control Panel”:

From the “Java Control Panel”, click on the “About…” button to check the installed Java version:

As you can see from the output, “Java 8” is installed on our macOS:

Checking Java Version on Linux (Ubuntu/Debian/CentOS)

You can check the Java version on Linux using various commands. Among them, the “Java –version” is the most convenient one. To use this command, open the terminal, type the command, and press enter:

java --version;

Note: We, execute this command on Ubuntu 24.04, you can execute it on any other Linux distribution of your choice:

Warning: If your system doesn’t have Java installed, you will encounter the “java: command not found” error.

Alternate Linux Commands to Check Java Version

Other than the “java –version” command, there are some other alternatives that help you find the Java version on Linux, as demonstrated below:

CommandDescription
javac -version It retrieves Java’s primary compiler version.
update-alternatives –list javaIt retrieves the path(if installed) where Java is installed on your system.
sudo apt list –installed | grep -i openjdk (for Ubuntu/Debian)
sudo yum list installed | grep -i openjdk (for CentOS)
This command shows the list of Java packages (installed on your system).  

Important: Visit the linked guide to learn how to install, set up, and use Java on Ubuntu 24.04.

That’s all about checking/finding the Java version on Windows, Mac, and Linux.

Final Thoughts

To check the Java version on Windows, Linux, or Mac operating systems, run the “java –version” command from the respective terminal. Also, you can use the “Java Control Panel” to check/find the Java version on your system using GUI. Checking the Java version and updating it(if necessary) helps you manage your applications(that are dependent on Java) efficiently. This post has illustrated various CLI and GUI methods to check Java versions on well-known operating systems like Windows, Mac, and Linux.

Category: Java

About Anees Asghar

Anees, a go-to expert of various technologies like PostgreSQL, Java, JS, and Linux. He has been contributing to the community through his words. A passion for serving the people excites him to craft primo content.

Previous Post: « How to Format a String With printf() in Java
Next Post: How to Convert Set to a List in Java? »

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

How to Initialize an Array in Java

Introduction to Java Server Faces (JSF)

Introduction to Java 6.0 New Features, Part–1

Java 6.0 Features Part – 2 : Pluggable Annotation Processing API

Introduction to Java Server Faces(JSF) HTML Tags

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact