How to install Java 6 on CentOS 6.2

First, we will check that java is already install or not on our system?

java -version

As, we can see that the java is not install on our system, so we will downloads the Java binary installer from Oracle. (In this example, we will download & install the jdk, but the procedure is exactly the same for jre).

Transfer the downloaded file (jdk-6u32***) to the CentOS from Windows machine using WinSCP.

Now, move to the directory where you copy the jdk file(in my case, it is in tmp directory) and give execute permission to jdk file:

cd /tmp/
sudo chmod +x jdk-6u32-linux-x64-rpm.bin

Run the jdk file:

sudo ./jdk-6u32-linux-x64-rpm.bin

Apply the alternatives:

sudo alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_32/bin/java 17000

We are done :-)
Check the installed version of java:

java -version

Hope this will help you!


Leave a Reply

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