Install Java SE Development Kit 7u40 on CentOS 6.4

Installing JDK on CentOS can be hard, so to help you I’ve made this simple tutorial. Hope it helps…

Download and install:

Go to an select JDK Download.

Install JDK:

rpm -ivh /path-to-file/jdk-7u40-linux-i586.rpm

And set it up:

alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000

Check if it is installed correctly:

java -version

Should return something like:

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Server VM (build 24.0-b56, mixed mode)


javac -version

Should return something like:

javac 1.7.0_40


Set JAVA_HOME variable:

echo "export JAVA_HOME="/usr/java/latest"" > /etc/profile.d/

Install Firefox browser support:

32-bit plugin:

alternatives --install /usr/lib/mozilla/plugins/ /usr/java/latest/jre/lib/i386/ 20000

64-bit plugin:

alternatives --install /usr/lib64/mozilla/plugins/ /usr/java/latest/jre/lib/amd64/ 20000


  1. Install Oracle Java JDK/JRE 7u25 on Fedora 19/18, CentOS/RHEL 6.4/5.9