Check JDK Version on CentOS

This section provides a tutorial on how to check the version information of the installed JDK packages on CentOS systems.

If you are using a CentOS (Free version of Red Hat Linux ) system, downloading and installing the latest JDK version might be difficult. But you can easily install binary packages of older JDK versions from CentOS central repository.

First check the current version of JDK on my CentOS system:

herong$ java -version
java version "1.7.0_161"
OpenJDK Runtime Environment (rhel- u161-b00)
OpenJDK Server VM (build 24.161-b00, mixed mode)

herong$ javac -version
-bash: javac: command not found

herong$ which java

herong$ ls -l /usr/bin/java
/usr/bin/java -> /etc/alternatives/java

herong$ ls -l /etc/alternatives/java
/etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk/bin/java

herong$ ls -l /usr/lib/jvm
drwxr-xr-x. 2017 java-1.6.0-openjdk-
drwxr-xr-x. 2017 java-1.7.0-openjdk-
lrwxrwxrwx. 2017 jre -> /etc/alternatives/jre
lrwxrwxrwx. 2017 jre-1.6.0 -> /etc/alternatives/jre_1.6.0
lrwxrwxrwx. 2017 jre-1.6.0-openjdk -> java-1.6.0-openjdk-
lrwxrwxrwx. 2017 jre-1.7.0 -> /etc/alternatives/jre_1.7.0
lrwxrwxrwx. 2017 jre-1.7.0-openjdk -> java-1.7.0-openjdk-
lrwxrwxrwx. 2017 jre-openjdk -> /etc/alternatives/jre_openjdk

Looks like I have only the JRE part of the OpenJDK 1.7 (and 1.6) installed, missing the compiler which is the developer component.

Then check the CentOS version and system architecture:

herong$ arch

herong$ lsb_release -a
LSB Version:	:base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:...
Distributor ID:	CentOS
Description:	CentOS release 6.9 (Final)
Release:	6.9
Codename:	Final

So I am running CentOS 6.9 on an i686 system.

Now I have two options to install the full version of OpenJDK:

See next tutorials for more details on both options.

Table of Contents

 About This JDK Tutorial Book

JDK (Java Development Kit)

 What Is JDK

 Download and Install JDK on Windows

 Writing My First Java Program

 Adding JDK "bin" Directory to Path Setting

 JDK Documentation Installation

 Download and Install JDK on macOS

Check JDK Version on CentOS

 Install JDK with "rpm" Command

 Install JDK with "yum" Command

 Java Date-Time API

 Date, Time and Calendar Classes

 Date and Time Object and String Conversion

 Number Object and Numeric String Conversion

 Locales, Localization Methods and Resource Bundles

 Calling and Importing Classes Defined in Unnamed Packages

 HashSet, Vector, HashMap and Collection Classes

 Character Set Encoding Classes and Methods

 Character Set Encoding Maps

 Encoding Conversion Programs for Encoded Text Files

 Java Logging

 Socket Network Communication

 Datagram Network Communication

 DOM (Document Object Model) - API for XML Files

 SAX (Simple API for XML)

 DTD (Document Type Definition) - XML Validation

 XSD (XML Schema Definition) - XML Validation

 XSL (Extensible Stylesheet Language)

 Message Digest Algorithm Implementations in JDK

 Private key and Public Key Pair Generation

 PKCS#8/X.509 Private/Public Encoding Standards

 Digital Signature Algorithm and Sample Program

 "keytool" Commands and "keystore" Files

 KeyStore and Certificate Classes

 Secret Key Generation and Management

 Cipher - Encryption and Decryption

 The SSL (Secure Socket Layer) Protocol

 SSL Socket Communication Testing Programs

 SSL Client Authentication

 HTTPS (Hypertext Transfer Protocol Secure)

 Outdated Tutorials


 Full Version in PDF/EPUB