Installing Jdk 7 on Centos

download jdk on console

cd /opt
sudo 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/7u75-b13/jdk-7u75-linux-x64.tar.gz"

then unpack

tar zxvf jdk-7u75-linux-x64.tar.gz

then create folder

mkdir /usr/java

then move

mv jdk1.7.0_75/ /usr/java/

install java

alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_75/bin/java 1

install javac

alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_75/bin/javac 1

install jar

alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_75/bin/jar 1

install javaws

alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_75/bin/javaws 1

test the installation

[root@host-50-244-171-31 opt]# java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

[root@host-50-244-171-31 opt]# javac -version
javac 1.7.0_75

then set java home

sh -c "echo export JAVA_HOME=/usr/java/jdk1.7.0_75 >> /etc/environment"

issue the command

source /etc/environment

test

[root@host-50-244-171-31 opt]# echo $JAVA_HOME
/usr/java/jdk1.7.0_75

this package is needed for javaws

yum -y install libX11-devel.x86_64

test javaws

[root@host-50-244-171-31 opt]# javaws -version
Java(TM) Web Start 10.75.2.13-fcs

Leave a Reply

Your email address will not be published. Required fields are marked *