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 http://www.oracle.com/technetwork/java/javase/downloads/index.html an select JDK Download.
Install JDK:
[cc lang=”bash” width=”100%”]
rpm -ivh /path-to-file/jdk-7u40-linux-i586.rpm
[/cc]
And set it up:
[cc lang=”bash” width=”100%”]
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
[/cc]
Check if it is installed correctly:
[cc lang=”bash” width=”100%”]
java -version
[/cc]
Should return something like:
[cc lang=”bash” width=”100%”]
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)
[/cc]
And
[cc lang=”bash” width=”100%”]
javac -version
[/cc]
Should return something like:
[cc lang=”bash” width=”100%”]
javac 1.7.0_40
[/cc]
OPTIONAL
Set JAVA_HOME variable:
[cc lang=”bash” width=”100%”]
echo “export JAVA_HOME=\”/usr/java/latest\”” > /etc/profile.d/java.sh
[/cc]
Install Firefox browser support:
32-bit plugin:
[cc lang=”bash” width=”100%”]
alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 20000
[/cc]
64-bit plugin:
[cc lang=”bash” width=”100%”]
alternatives –install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 20000
[/cc]