How to Install JDK on Cent OS


Download latest version :- 

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 

Step for 32 Bit 

cd /opt

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-i586.tar.gz"

# tar xzf jdk-7u60-linux-i586.tar.gz
# cd /opt/jdk1.7.0_65/
# alternatives --install /usr/bin/java java /opt/jdk1.7.0_65/bin/java 2
# alternatives --config java

There are 4 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
  1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
  2           /opt/jdk1.7.0_55/bin/java
  3           /opt/jdk1.7.0_60/bin/java
  4           /opt/jdk1.7.0_65/bin/java

Enter to keep the current selection[+], or type selection number: 4 Press Enter

# alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_65/bin/jar 2
# alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_65/bin/javac 2
# alternatives --set jar /opt/jdk1.7.0_65/bin/jar
# alternatives --set javac /opt/jdk1.7.0_65/bin/javac 

# java -version


Use this for 64 bit:-
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz"

Setup JAVA_HOME Variable

# export JAVA_HOME=/opt/jdk1.7.0_65
# export JRE_HOME=/opt/jdk1.7.0_65/jre
# export PATH=$PATH:/opt/jdk1.7.0_65/bin:/opt/jdk1.7.0_65/jre/bin











Previous Post
Next Post
Related Posts

0 Comments: