Saturday, November 1, 2014

How to install JDK on Redhat/CentOS usng the alternatives command


http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

Install Java JDK or JRE package

## JDK 32-bit ##
rpm -Uvh /path/to/binary/jdk-7u67-linux-i586.rpm
 
## JDK 64-bit ##
rpm -Uvh /path/to/binary/jdk-7u67-linux-x64.rpm
 
## JRE 32-bit ##
rpm -Uvh /path/to/binary/jre-7u67-linux-i586.rpm
 
## JRE 64-bit ##
rpm -Uvh /path/to/binary/jre-7u67-linux-x64.rpm
 
 

Install Sun/Oracle JDK java, javaws, libjavaplugin.so (for Firefox/Mozilla) and javac with alternatives –install command

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 200000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 200000
 
## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000

No comments: