Oracle Java CentOS Installation

Overview

Oracle Java CentOS 6 Installation and configure it as the default Java Runtime Environment.

Download Oracle JRE or JDK

JRE – Java Runtime Environment
JDK – Java Development Kit (Includes JRE)
For CentOS x86_64 download the x64 Version
Oracle Java download page

Install Oracle Java CentOS RPM

For JDK:

rpm -Uvh /path/to/binary/jdk-*-linux-*.rpm

For JRE:

rpm -Uvh /path/to/binary/jre-*-linux-*.rpm

Configure the Default Java

JRE and JDK

alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000

JRE Only

 
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000

Mozilla x32 plugin

 
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 20000

Mozilla x64 Plugin

alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 20000

Select default Java

alternatives --config java

Select ‘/usr/java/latest/jre/bin/java’:

There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
*+ 3           /usr/java/latest/jre/bin/java

Enter to keep the current selection[+], or type selection number: 3

Verify Java Version

java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Enjoy.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.