1.卸载原有的openjdk
yum -y remove copy-jdk-configs-3.3-10.el7_5.noarch
2.官网下载 jdk-8u171-linux-x64.tar.gz并解压,下载完成之后通过xftp上传到centos中,位置:/home/jiajing/下载/jdk1.8.0_411
3.配置环境变量
编辑文件
vim /etc/profile
export JAVA_HOME=/home/jiajing/下载/jdk1.8.0_411
export JRE_HOME=/home/jiajing/下载/jdk1.8.0_411/jre
export PATH=$PATH:/home/jiajing/下载/jdk1.8.0_411/bin
export CLASSPATH=./:/home/jiajing/下载/jdk1.8.0_411/lib:/home/jiajing/下载/jdk1.8.0_411/jre/lib
立即生效
source /etc/profile
4.检查是否成功
java -version
5.添加权限
第四步可能会报错:
[root@localhost jdk1.8.0_411]# java -version
-bash: /home/jiajing/下载/jdk1.8.0_411/bin/java: Permission denied
添加权限就好了:
chmod 755 /home/jiajing/下载/jdk1.8.0_411/bin/java
成功:
标签:jdk1.8,openjdk,export,411,home,完整版,jiajing,下载 From: https://blog.csdn.net/syyangg/article/details/140119707