Install SUN/Oracle JDK on CentOS or Fedora

Posted on Tue 19 April 2011 in CentOS

1. Download SUN or now Oracle JDK (.rpm.bin format) from Oracle Website: http://www.oracle.com/technetwork/java/javase/downloads/index.html

  1. make .bin file executeable
chmod +x <file>.rpm.bin
  1. run the installer
./<file>.rpm.bin
  1. link the installed jdk into your environment
alternatives --install /usr/bin/java java /usr/java/default/bin/java 1
alternatives --config java
  1. test
java -version

output should look like this:

java version "1.5.0_19"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02)

Java HotSpot(TM) Client VM (build 1.5.0_19-b02, mixed mode, sharing)

More informations: http://wiki.centos.org/HowTos/JavaOnCentOS