安装JDK
1、下载JDK
JDK官网:https://www.oracle.com JDK下载地址:https://www.oracle.com/java/technologies/downloads/archive/ JDK8下载地址:https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
2、安装JDK
]# tar zvfx ./jdk-8u162-linux-x64.tar.gz -C /usr/local/ ]# cd /usr/local/ ]# ln -s jdk1.8.0_162 jdk
3、配置JDK的环境变量
//(1)向/etc/profile文件中添加如下配置 ]# vim /etc/profile export JAVA_HOME=/usr/local/jdk export JRE_HOME=/usr/local/jdk/jre export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${PATH} export CLASSPATH=::${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar //(2)使配置生效 ]# source /etc/profile
4、验证JDK是否已经安装配置成功
//如果安装配置成功,则会正确显示出JDK的版本信息 ]# java -version java version "1.8.0_162" Java(TM) SE Runtime Environment (build 1.8.0_162-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
1
# #