Ubuntu Linux Find JDK Version

How do I find out my JDK version under Ubuntu Linux operating systems? How do I find out JDK version under any Linux distribution?

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to find out JDK version:
java -version
Sample outputs:

java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu1~10.04.1)
OpenJDK Server VM (build 19.0-b09, mixed mode)

To list all installed jdk version under Ubuntu / Debian Linux, enter:
dpkg --list | grep -i jdk
Sample outputs:

ii  default-jdk                                 1.6-34                                          Standard Java or Java compatible Development
ii  icedtea-6-jre-cacao                         6b20-1.9.2-0ubuntu1~10.04.1                     Alternative JVM for OpenJDK, using Cacao
ii  openjdk-6-jdk                               6b20-1.9.2-0ubuntu1~10.04.1                     OpenJDK Development Kit (JDK)
ii  openjdk-6-jre                               6b20-1.9.2-0ubuntu1~10.04.1                     OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-6-jre-headless                      6b20-1.9.2-0ubuntu1~10.04.1                     OpenJDK Java runtime, using Hotspot JIT (hea
ii  openjdk-6-jre-lib                           6b20-1.9.2-0ubuntu1~10.04.1                     OpenJDK Java runtime (architecture independe

A Note About RPM Based Linux Distributions

If you are using RPM based distro, try:
$ java -version
$ javac -version
$ rpm -qa | egrep -i "(jdk|jre)"

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • fher98 Nov 2, 2011 @ 15:59

    I updated my system and now I have problems with the new jre, you know how to get back to and old version with apt.


    • t Aug 31, 2015 @ 13:49

      sudo update-alternatives –config java
      sudo update-alternatives –config javac

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz