Linux安装JDK8
- 在linux中输入如下命令
1.1 上传jdk-8u291-linux-x64.tar.gz到/usr/local路径下
1.2 解压jdk-8u291-linux-x64.tar.gz
[root@VM-12-10-centos ~]# cd /usr/local/
[root@VM-12-10-centos local]# tar -zxvf jdk-8u291-linux-x64.tar.gz
1.3 将解压的jdk1.8.0_291移动并命名为jdk1.8
[root@VM-12-10-centos local]# mv jdk1.8.0_291 /usr/local/jdk1.8
1.4 修改环境变量
[root@VM-12-10-centos local]# vim /etc/profile
在profile文件最未尾加上
export JAVA_HOME=/usr/local/jdk1.8
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
1.5 刷新配置
[root@VM-12-10-centos local]# source /etc/profile
1.6 验证配置
[root@VM-12-10-centos local]# java -version
出现如下显示 则说明安装成功
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)