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:
[code]rpm -Uvh /path/to/binary/jdk-*-linux-*.rpm[/code]
For JRE:
[code]rpm -Uvh /path/to/binary/jre-*-linux-*.rpm[/code]

Configure the Default Java

JRE and JDK

[code]
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
[/code]

JRE Only

[code]
alternatives –install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
alternatives –install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
[/code]

Mozilla x32 plugin

[code]
alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 20000
[/code]

Mozilla x64 Plugin

[code]
alternatives –install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 20000
[/code]

Select default Java

[code]
alternatives –config java
[/code]

Select ‘/usr/java/latest/jre/bin/java’:
[code]
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
[/code]

Verify Java Version

[code]
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)
[/code]

Enjoy.

Leave a Reply

Your email address will not be published.

*

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