centos 7 安装 jdk
一、步骤一:下载jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
步骤二:解压jdk-8u151-linux-x64.tar.gz ,执行以下命令:
mkdir /usr/local/java/
tar xzvf jdk-8u151-linux-x64.tar.gz
cp -R jdk1.8.0_151 /usr/local/java/
步骤三:
vi /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_151 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib export PATH=$JAVA_HOME/bin:$PATH
保存退出后,执行source /etc/profile是修改的环境变量生效
步骤四:执行java -version命令,验证jdk是否安装成功: