• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Check Java Version on Linux System

Written by Admin, Updated On September 12, 2020
java, terminal
How to Check Java Version

Java is most popular programming language. It is used for building different kinds of cross-platform applications. This guide shows you how to check the version of Java installed on your Linux system.

Java Version Format#

Java uses semantic versioning. When looking at the version number, there are usually three digits to read:

MAJOR.MINOR.SECURITY

For example, in Java 11.0.8, 11 is major version, 0 is a minor version, and 8 is a security version.

  • MAJOR – Its for new features and functions.
  • MINOR – It indicates bug fixes and compatible improvements.
  • SECURITY – It contains the security fixes.

How to Check Java Version in Linux#

To check which version is installed on your system, open terminal on your system and run the java --version or java -V command:

java --version

In output, it will print default Java version of your system. On this system it’s 11.0.8. It may be different version on your system.

If you got error message like “java: command not found”, that means the Java is not installed on your Linux system. To install the Java on your Linux system visit appropriate link as per your operating system:

  • Install Java on Ubuntu
  • How to Install Java on Debian
  • Install Java on CentoS

To check if your system have multiple versions of Java installed, run below command:

 sudo update-alternatives --config java

If your machine have multiple Java version installed it should show something like below:

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:

Otherwise, it should show as following if there is only one version is installed:

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.

Conclusion#

In this article explained how to check the Java version using java --version command.

If you have any question or suggestion, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install and Configure Fail2ban on CentOS 8
Next Article   W Command in Linux

Related Posts

  • How to Use sed to Find and Replace String in Files

    How to Use sed to Find and Replace String in Files

    December 18, 2020
  • Linux Head Command

    Linux Head Command

    December 16, 2020
  • Rename Files and Directories in Linux

    How to Rename Files and Directories in Linux

    December 15, 2020

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook