一、下载JDK
- 官网地址:https://www.oracle.com/java/technologies/downloads/#java8
- 百度网盘
链接:https://pan.baidu.com/s/1cH-UZKKBz3338Orqo0idWg?pwd=azv0 提取码:azv0 –来自百度网盘超级会员V5的分享
二、保存物理机目录
[root@izwz9eldxtlzr8ehu1fmjbz java]# pwd
/root/env/java
[root@izwz9eldxtlzr8ehu1fmjbz java]# ls
jdk-8u311-linux-x64.tar.gz
三、解压
tar -zxvf /root/env/java/jdk-8u311-linux-x64.tar.gz -C /env/jdk/
四、声明环境变量
- 声明环境变量
#jdk解压目录
export JAVA_HOME=/env/jdk/jdk1.8.0_311
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
- 查看环境变量
[root@izwz9eldxtlzr8ehu1fmjbz java]# echo $JAVA_HOME
/env/jdk/jdk1.8.0_311
- 验证是否成功
[root@izwz9eldxtlzr8ehu1fmjbz java]# java -version
java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 1.8.0_311-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)
|