JDK安装

CentOS 7.2.1511 + JDK1.8.0_131

环境:

Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511

下载地址

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
下载rpm包到本地

安装

rpm -ivh jdk-8u131-linux-x64.rpm

环境变量配置

vi /etc/profile

加入以下配置:

export JAVA_HOME=/usr/java/jdk1.8.0131
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

加载配置

source /etc/profile

测试

java -version
输出
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)