06 October, 2007

Java Install on Fedora 7 - simplified

During an attempt to install Azureus on my Fedora 7 based lappy, i noticed that there aren't too many simple and easy to follow guides for Java(JRE) Install on Fedora 7. Here's an attempt to do so. Based on tutorial available here.

1. Download Java Runtime Env (JRE) from here. Choose the self extracting package of your choice(32/64 bit). I had downloaded the JRE 6 Update3 version called jre-6u3-linux-i586.bin.

2. Login as root
$su -

3. Move files to a install location like /opt.
#mv jre-xxx-linux-i586.bin /opt
#cd /opt

4. Install as follows.
#sh jre-6u3-linux-i586.bin
This will install the JRE in the same directory(/opt).

5. Now Fedora 7 comes with a default version of GNU Java called GCJ. We want to have Sun Java as the default Java instead of GCJ.
#vi /etc/profile.d/java.sh
Add the following 2 lines to the file.
export J2RE_HOME=/opt/jre1.6.0_03
export PATH=$J2RE_HOME/bin:$PATH
Save file and exit.
Now run the following commands.
#source /etc/profile.d/java.sh
#alternatives --install /usr/bin/java java /opt/jre1.6.0_03/bin/java 2
#alternatives --config java
Type '2' when asked to enter an option and hit Enter.
This makes Sun Java the Default Java Installation. You can revert back to GCJ as the default Java using the alternatives command as shown above.

6. Setup the Java Firefox Plugin.
Install libcompat as the Sun Java is compiled using a different version of the libraries than the one available with the Fedora 7 distro.
#yum install compat-libstdc++-33

#cd /usr/lib/mozilla/plugins
#ln -s /opt/jre1.6.0_03/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so

Done !
7. Now we can test our Sun Java Installation by entering the following URL in the Browser's Location Bar after Restarting your Browser.
http://www.java.com/en/download/installed.jsp?detect=jre