20070502 installing java on rhel with alternatives - plembo/onemoretech GitHub Wiki

title: Installing Java on RHEL with Alternatives link: https://onemoretech.wordpress.com/2007/05/02/installing-java-on-rhel-with-alternatives/ author: lembobro description: post_id: 717 created: 2007/05/02 18:16:00 created_gmt: 2007/05/02 18:16:00 comment_status: open post_name: installing-java-on-rhel-with-alternatives status: publish post_type: post

Installing Java on RHEL with Alternatives

The Alternatives system is a powerful tool for configuring third party software on Fedora Core. This article describes how to use it to install Sun's Java SDK on a workstation or server. Download the latest Java SDK for Linux from Sun and install (rpm -Uvh for the rpm package, tar xzf for the tar.gz). I now put it in Sun's preferred default location, /usr/java/jdk-1.5.0_x. Once installed I symlink from the latest version to /usr/java/jdk. By doing this I can avoid having to peform the procedure that follows again with each new version of Java. Once this is done, execute the following commands to actually register this as the version of Java to use:

/usr/sbin/alternatives --install /usr/bin/java java 
/usr/java/jdk/bin/java 301


/usr/sbin/alternatives --config java

On that last command, be sure to select the actual copy of (or symlink to) the Java version you want to use. Make sure the path given is correct for your system. Repeat this for the javac command. Finally, set the environment for everyone on the machine by creating a java.sh script in /etc/profile.d:

#!/bin/sh
export JAVA_HOME=/usr/java/jdk
export JRE_HOME=$JAVA_HOME/jre
export J2RE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$J2RE_HOME/bin:$PATH

Now you can go and manually symlink the Mozilla plugin so that it will be loaded when your browser starts.

Copyright 2004-2019 Phil Lembo