Installing Jdk 7 on Centos

Posted by

download jdk on console

cd /opt
sudo wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" \

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


[root@host-50-244-171-31 opt]# echo $JAVA_HOME

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

Leave a Reply

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