Here’s how I installed JDK on Centos (thanks to http://www.trading-shim.org/faq/?java)
Download
Go to http://java.sun.com/javase/downloads/index.jsp and download the desired file.
Extract the .bin file
[root@localhost tmp]# chmod 755 j2re-1_4_2_15-linux-i586-rpm.bin
[root@localhost tmp]# ./j2re-1_4_2_15-linux-i586-rpm.bin
Install the .rpm file
[root@localhost tmp]# rpm -Uvh j2re-1_4_2_15-linux-i586.rpm
Preparing... ########################################### [100%]
1:j2re ########################################### [100%]
Adjust environment
Finally add the path to the java executable in the /etc/profile file.
Test
$ java -version
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)
View symbolic links
In my environment a symbolic link is created in /usr/bin/java which points to /usr/java/default/bin/java.
$ which java
/usr/bin/java
$ ls -la /usr/bin/java
lrwxrwxrwx 1 root root 26 Jul 31 14:38 /usr/bin/java -> /usr/java/default/bin/java
$ ls -la /usr/java/
total 40
drwxr-xr-x 4 root root 4096 Jul 31 14:38 .
drwxr-xr-x 14 root root 4096 Jun 14 21:03 ..
lrwxrwxrwx 1 root root 16 Jul 31 14:38 default -> /usr/java/latest
drwxr-xr-x 7 root root 4096 Jul 31 14:16 j2re1.4.2_15
drwxr-xr-x 9 root root 4096 Jul 31 14:38 jdk1.6.0_02
lrwxrwxrwx 1 root root 21 Jul 31 14:38 latest -> /usr/java/jdk1.6.0_02
$
This was extremely helpful. Thanks!