Install Java JDK 1.8 – CentOS 6.7

I usually download the rpm or source from Java.com and install it manually but this time around it just wouldn’t work. So this is the alternative, read: supported way, of installing Java JDK 1.8.

Issue yum list *jdk* to get a list of what’s available:

Available Packages

java-1.6.0-openjdk.x86_64                  1:1.6.0.36-1.13.8.1.el6_7    updates
java-1.6.0-openjdk-demo.x86_64             1:1.6.0.36-1.13.8.1.el6_7    updates
java-1.6.0-openjdk-devel.x86_64            1:1.6.0.36-1.13.8.1.el6_7    updates
java-1.6.0-openjdk-javadoc.x86_64          1:1.6.0.36-1.13.8.1.el6_7    updates
java-1.6.0-openjdk-src.x86_64              1:1.6.0.36-1.13.8.1.el6_7    updates
java-1.7.0-openjdk.x86_64                  1:1.7.0.85-2.6.1.3.el6_7     updates
java-1.7.0-openjdk-demo.x86_64             1:1.7.0.85-2.6.1.3.el6_7     updates
java-1.7.0-openjdk-devel.x86_64            1:1.7.0.85-2.6.1.3.el6_7     updates
java-1.7.0-openjdk-javadoc.noarch          1:1.7.0.85-2.6.1.3.el6_7     updates
java-1.7.0-openjdk-src.x86_64              1:1.7.0.85-2.6.1.3.el6_7     updates
java-1.8.0-openjdk.x86_64                  1:1.8.0.51-3.b16.el6_7       @updates
java-1.8.0-openjdk-devel.x86_64            1:1.8.0.51-3.b16.el6_7       @updates
java-1.8.0-openjdk-headless.x86_64         1:1.8.0.51-3.b16.el6_7       @updates
java-1.8.0-openjdk-debug.x86_64            1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-demo.x86_64             1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-demo-debug.x86_64       1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-devel-debug.x86_64      1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-headless-debug.x86_64   1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-javadoc.noarch          1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-javadoc-debug.noarch    1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-src.x86_64              1:1.8.0.51-3.b16.el6_7       updates
java-1.8.0-openjdk-src-debug.x86_64        1:1.8.0.51-3.b16.el6_7       updates
ldapjdk.x86_64                             4.18-6.el6                   base
ldapjdk-javadoc.x86_64                     4.18-6.el6                   base

To install, issue:

yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel

To verify installation, issue:

java -version
openjdk version "1.8.0_51"
OpenJDK Runtime Environment (build 1.8.0_51-b16)
OpenJDK 64-Bit Server VM (build 25.51-b03, mixed mode)

This is what you should see to signal a successful install.