操作系统:centos7.9
jdk版本:jdk1.8.0_141
1、jdk旧版下载地址:https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
注:下载jdk需要提前注册账号
访问 https://www.oracle.com/java/technologies/downloads/archive/
点击进入后,向下查找自己想要的版本
#下载jdk-8u141-linux-x64.tar.gz
2、 上传jdk安装包到服务器
3、[root@localhost ~]# tar zxvf jdk-8u141-linux-x64.tar.gz -C /usr/local/ #解压到/usr/local/
[root@localhost ~]# vim /etc/profile #文件最后面添加
export JAVA_HOME=/usr/local/jdk1.8.0_141 export JAVA_HOME=$JAVA_HOME/jre export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
4、[root@localhost ~]# source /etc/profile #刷新系统变量
5、[root@localhost ~]# java -version #查看jdk版本
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)
标签:JAVA,jdk,centos,java,export,HOME,安装,localhost From: https://www.cnblogs.com/xgsh/p/16639565.html