Thursday, July 2, 2009

Installing Java Runtime Envoriment in Linux - Fedora, RedHat, CentOS distros.

This is actually meant for Fedora, RedHat, CentOS distros.

(1.)log into your root user.

(2.)Go to this link ( http://java.sun.com/j2se/1.5.0/download.jsp ) and download the Linux self-extracting file (jre-1_5_0_07-linux-i586.bin) NOT THE RPM!

(3.)Move jre-1_5_0_07-linux-i586.bin to your /opt/ folder.

(4.)Open the terminal and type "cd /opt/" without the ".

(5.)[root@localhost opt]# sh ./jre-1_5_0_06-linux-i586.bin
(type 'yes')

(6.)[root@localhost opt]# mv -f jre1.5* /opt/jre1.5

(7.)[root@localhost opt]# ln -s /opt/jre1.5/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla plugins/libjavaplugin_oji.so

Now we will install the JRE package into Mozilla through 'alternatives'. When Mozilla runs 'java' command, FC5 will always choose the default "GNU Java" for Mozilla to choose Sun's java do the following.

(1)[root@localhost opt]# /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.5/bin/java 2
(2.)[root@localhost opt]# echo 2 | alternatives --config java
"It will ask to choose which one, Type "Echo 2" then go to number (3.) below"

(3.)[root@localhost opt]# java -version
When you enter this, It will tell you the version of the java that you just installed. IF it doesn't show anything or gives you an error, Delete the jre1.5 folder in /opt/ start over.

This is what it should look like (see below) if you done it right.

[root@localhost opt]# java -version
java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02)
Java HotSpot(TM) Client VM (build 1.5.0_19-b02, mixed mode, sharing)