Adding Java support to Linux (specifically CentOS / Redhat)

Note: this method was developed for older CentOS / Redhat systems and is unlikely to be required now.

Go to http://java.sun.com/ and download the JRE for your distribution.

If your distro supports RPM packages, get the “Linux self extracting RPM” version.

This will then create a .bin file, which you need to execute – ./.bin.

This will then extract the files to the current directory/java-xxx-xx

If you extracted these files in /usr/local then your java will be in /usr/local/java-xxx-xx which you can either rename to just java, or create a symolic link e.g. ln -s /usr/local/java /usr/local/java-xxx-xx

Then edit /etc/profile, and add this directory to your path, as per below.

# Path manipulation
if [ `id -u` = 0 ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
JAVA_HOME=/usr/java/j2sdk1.4.2_01
pathmunge $JAVA_HOME/bin after
export JAVA_HOME

admin has written 102 articles