Having Redhat or Centos Linux installed and running, by default the Operating system might come with an older Java Version, like 1.4.x
Download just the Java Binary self extractable:
- Create a new directory in /usr: mkdir /usr/java
- copy jrebinary file file to /usr/java
- Run and complete the java installation: /usr/java/jre-1_5_0_14-linux-i586-rpm.bin
- Create the java environment variables and make sure they are loaded when a session is open. To do that:
- Create a new file java.sh in the profile.d directory: vi /etc/profile.d/java.sh
- Type the following text:
export JAVA_BIN CLASSPATH PATH
- Save the file and exit the editor
- Close the session and open it again. To make sure the environment variables are created, type the command: export and make sure that the JAVA_HOME and JAVA_BIN are listed.
- Type the following command to add the installed java version to the RedHat configuration:
/usr/sbin/alternatives –install /usr/bin/java java /usr/java/jre1.5.0_15/bin/java 2
- Type the following command: /usr/sbin/alternatives –config java
- The following text will be displayed:
+ 1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
Enter to keep the current selection[+], or type selection number:
- Type 2 and press Enter.
- To verify that RedHat is now using the correct version of Java, type: java -version and make sure that the JRE 18.104.22.168 is used.