How to install Java on RHEL 5
// March 7th, 2010 // No Comments » // how to, linux, rhel
1. Check your operating system just to be sure:
[root@andrei ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
2. Check weather it’s a 32 or 64 bit version:
[root@andrei ~]# uname -a
Linux <output omitted> x86_64 x86_64 x86_64 GNU/Linux
The current OS is a 64 bit system, indicated by x86_64.
3. Download Java (JDK) – select Linux or Linux64 depending on your OS and download the required file. In my case is jdk-6u18-linux-x64-rpm.bin.
4. Make the downloaded file executable and then run it:
[root@andrei ~]# chmod u+x jdk-6u18-linux-x64-rpm.bin
[root@andrei ~]# ./jdk-6u18-linux-x64-rpm.bin
5. After you accept the License Agreement the installation starts.
6. Your Linux distribution most likely comes with a Java version installed, but it is probably the GNU Compiler for Java (gij – GNU libgcj).Now you need to configure the system to use the newly installed Sun Java.
[root@andrei ~]# alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_18/bin/java 2 [root@andrei ~]# alternatives --config java
After the second command you will be asked to make a selection of the Java version used in your system. Choose option number 2.
7. Check that your system has a new Java environment:
[root@andrei ~]# alternatives --display java
See what version of Java Runtime Environment you are using now:
[root@andrei ~]# java -version java version "1.6.0_18" Java(TM) SE Runtime Environment (build 1.6.0_18-b07) Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)



