CentOS 7安装Oracle JDK,查看Linux是否自带的JDK,如有openJDK,则卸载
java -version
rpm -qa | grep -E '^open[jre|jdk]|j[re|dk]'
卸载openjdk
su root
yum -y remove java java-1.7.0-openjdk
下载oracle jdk
wget --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.tar.gz
解压jdk
tar -xzvf jdk-8u77-linux-x64.tar.gz
移动jdk到/usr/local,建立软连接
mv jdk1.8.0_77/ /usr/local
ln -s /usr/local/jdk1.8.0_77/ /usr/local/jdk
编辑/etc/profile
vim /etc/profile
加入jdk的配置
JAVA_HOME=/usr/local/jdk
PATH=${PATH}:${JAVA_HOME}/bin
export JAVA_HOME PATH
source
source /etc/profile
查看是否安装jdk成功
java -version