1.参考下载https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2696671285@qq.com
Oracle123
2.在/usr/目录下创建java
[root@docker ~]# cd /usr/ [root@docker usr]# mkdir java
3.使用xftp把下载的jdk-8u161-linux-x64.tar.gz上传到linux上的/usr/java;
3.解压JDK安装包:
tar -zxvf jdk-8u231-linux-x64.tar.gz
4.配置环境变量
root@docker java]# vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_231 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
5.使刚更改的环境变量生效
[root@docker java]# source /etc/profile
6.检查jdk8是否安装成功:
[root@docker java]# java -version java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode) [root@docker java]#