Download the JDK from the Java website. The simplest way is to use wget. Example:
[root@server ~]# wget http://cds.sun.com/is-bin/ ... jdk-6u23-linux-x64-rpm.bin
Modify permissions to execute the .bin file:
[root@server ~]# chmod +x jdk-6u23-linux-x64-rpm.bin
Run the .bin file:
[root@server ~]# ./jdk-6u23-linux-x64-rpm.bin
Once complete, the JDK should be installed to /usr/java/. Quick test to see if Java is working correctly:
[root@server ~]# java -version java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)
Set the JAVA_HOME environment variable:
[root@server ~]# echo "export JAVA_HOME=/usr/java/default" > /etc/profile.d/java.sh