Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Check Java Version - DesignLinux

designlinux 0 Comments

Java is one of the most popular programming languages in the world, used for building different types of cross-platform applications.

This article explains how to check what version of Java is installed on your Linux system using the command line. This can be useful when installing applications that require a specific version of Java.

Java Versioning #

Java uses semantic versioning . Production-ready releases are versioned in the following scheme:

MAJOR.MINOR.SECURITY

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

  • MAJOR – Major releases are bringing new features and functions.
  • MINOR – Minor releases contain various bug fixes and compatible improvements.
  • SECURITY – Security releases provide critical security fixes.

Checking Java Version #

To find out which Java version is installed on your system, run the java -version command:

java -version

The command will display the default Java version:

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 have Java version 11.0.8 installed on our system. The version installed on your system may be different.

If you get “java: command not found” it means that Java is no installed on the system. To install Java, use one of the following guides, depending on your Linux distribution:

  • Install Java on Ubuntu.
  • Install Java on Debian.
  • Install Java on CentoS.

The system may also have multiple versions of Java installed at the same time. To check whether you have multiple Java installations on your machine run:

sudo update-alternatives --config java

If you have only 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 multiple Java installations, the command will display a menu where you can select which version will 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 in the Selection column) and press Enter.

Conclusion #

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

Feel free to leave a comment if you have any questions.

terminal java

Related

Tags: java, terminal

The 10 Best Rolling Release Linux Distributions

Prev Post

How to Install and Configure Fail2ban on CentOS 8

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 1
  • 1,052
  • 609,500

DesignLinux.com © All rights reserved

Go to mobile version