Linux版本信息:
[root@VM-0-12-centos bin]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
将下载好的jdk上传到linux,并解压到指定目录:
[root@VM-0-12-centos bin]# tar -zxvf jdk-8u212-linux-x64.tar.gz -C /usr/local/java/
[root@VM-0-12-centos bin]# cd /usr/local/java/jdk1.8.0_212/
配置环境变量:
[root@VM-0-12-centos jdk1.8.0_212]# vi /etc/profile.d/java.sh
export JAVA_HOME=/usr/local/java/jdk1.8.0_212
export PATH=$PATH:$JAVA_HOME/bin
测试是否安装成功:
[root@VM-0-12-centos bin]# jps
29355 Jps
[root@VM-0-12-centos bin]# source /etc/profile
[root@VM-0-12-centos bin]# java -version
java version "1.8.0_212"
Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)
[root@VM-0-12-centos bin]# javac -version
javac 1.8.0_212