Oct 9, 2023 3 min read

Step by Step Guide to Check Java Version

Check the Java Version with our step-by-step tutorial. It is a widely-used programming language known for its versatility and portability.

Check Java Version
Table of Contents


Before we begin talking about how to check the Java version, let's briefly understand – What is Java ?

Java is a widely used programming language known for its versatility and portability. It was created by Sun Microsystems and became popular due to its ability to run on different platforms. Java allows developers to build a diverse range of applications, from web and mobile apps to desktop software.

It has a reputation for being secure and robust, making it a preferred choice for enterprise-level projects. With Java's extensive libraries and frameworks, developers can streamline their coding process and create efficient programs. Whether you're a beginner or an experienced developer, Java offers a wealth of resources and community support to help you succeed.

In this tutorial, you will check the Java version. We will also address a few FAQs on how to check the Java version on Ubuntu 20.04.

Advantages of Java

  1. Portability: Java's "write once, run anywhere" feature allows programs to run on any platform.
  2. Versatility: Java supports a wide range of applications, from web and mobile to enterprise-level software.
  3. Security: Java comes with built-in security features that protect against malicious attacks and vulnerabilities.
  4. Robustness: Java's strong error-checking and exception handling make it highly reliable and resistant to crashes.
  5. Rich library ecosystem: Java offers a vast collection of libraries and frameworks that expedite development and simplify coding tasks.

Versioning in Java

Java employs semantic versioning. Versioning schemes for production-ready releases are as follows:


In Java 11.0.8, for example, 11 is a major version, 0 is a minor version, and 8 is a security version.

MAJOR - Major updates include new features and functions.

MINOR - Minor releases include bug fixes and compatibility enhancements.

SECURITY - Security updates include critical security updates.

Checking Java Version

Run the java -version command to see which version of Java is installed on your system:

java -version

The command will show the installed version of Java:


openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

In this example, we've got Java version 11.0.8 installed on our system. The version installed on your system could be different.

If you get “java: command not found” it implies that Java is not installed on the system. To install Java, go through Install Java on Ubuntu:

The system might also have multiple versions of Java installed at the identical time. To test whether you've got multiple Java installations on your machine run:

sudo update-alternatives --config java

If you've got just one Java installation, the output will look something like this:


There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.

Otherwise, if you have got multiple Java installations, the command will display a menu where you'll be able to select which version is going to be the default Java version:


There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number:

To change the default Java version, just enter the version number (the number within the Selection column) and press Enter.

FAQs to Check Java Version

Is it possible to have multiple Java versions installed on my computer? 

Yes, it's possible to have multiple Java versions installed. Ensure you set the desired version as the system default.

Why is it important to check the Java version? 

Checking the Java version helps ensure compatibility with software or applications that require a specific Java version.

How can I update Java to the latest version? 

You can update Java by visiting the official Java website and downloading the latest version from there.

Can I check the Java version through the graphical user interface? 

Yes, you can check the Java version by going to the Control Panel (Windows) or System Preferences (Mac) and locating the Java settings.

How can I check the Java version in the web browser?

 You can check the Java version by visiting the official Java website and using their Java version detection tool.

What if the Java version is outdated? 

If your Java version is outdated, it is recommended to update it to ensure you have access to the latest features, performance improvements, and security patches.

Are there any compatibility issues between Java versions? 

There can be compatibility issues between different Java versions. It's important to ensure that the Java version matches the requirements of the applications or software you are using.


Finding out what Java version is installed on your Linux system is incredibly easy, just type java -version.

If you have any queries, please leave a comment below and we’ll be happy to respond to them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.