Installing Java 1.6 in CentOS 6 – The Simplest Way

Default repository in CentOS 6 will give you Java 1.5 JRE and SDK packages. I will show you on how to install version 1.6 using yum.  You just need to enable RPMforge repository and another simple steps required after that.

Variables as follow:

OS: CentOS 6 64bit
Current Java version: 1.5
Upgraded Java version: 1.6

1. Install RPMforge into yum repository:

$ cd /usr/local/src
$ rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
$ wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
$ rpm -Uhv rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

2.  Remove previous Java version 1.5, if you have it installed:

$ yum remove java-1.5-*

3. Lets install Java 1.6. The package name will be java-1.6.0-openjdk.x86_64:

$ yum install java-1.6.0-openjdk.x86_64 -y

4. We need to export the JAVA_HOME environment. This steps is optional:

$ export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre

5. Lets check our latest Java version:

$ java -version
java version "1.6.0_17"
OpenJDK Runtime Environment (IcedTea6 1.7.9) (rhel-1.36.b17.el6_0-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

As simple as ABC!

12 thoughts on “Installing Java 1.6 in CentOS 6 – The Simplest Way

  1. Great guide. Followed it step by step and it worked perfectly 🙂 Thanks!

    Reply

  2. I have tried many ways to install Java. This is best way. I got the exect same result as you said. Thank you so much!
    But I am newer for the Linux. Could you tell me how to set the environment for the Java? I use Centos 5.8 and when I install the intel Fortran compiler 11.1, it always said no compatible java run time environment. Of course, I changed the x86_64 to i386 because I use 32bit OS. I did the export the JAVA_HOME environme as you said, but it didn’t work. Thanks again.

    Reply

  3. I tried many ways. This is the best way to install Java. Simple and work! Thank you so much! But I am a newer for the Linux. I use Centos 5.8. When I install intel Fortran compiler 11.1, I still have the problem no compatible java run time environment. I think it’s the problem about the environment variable setting. Could you tell me how to set the JAVA_HOME environment? Thanks again.

    Reply

  4. Is this the same thing as installing a JVM? I’m trying to get SOLR and LUCENE running on a CentOS 6 VPS.

    Reply

Leave a Reply

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