源码包安装jdk1.8

xiaoxiao2021-03-01  14

==删除原来的jdk包==

[root@ycj ~]# rpm -qa | grep java //查询原有rpm包

[root@ycj ~]# rpm -e --nodeps python-javapackages-3.4.1-11.el7.noarch tzdata-java-2018e-3.el7.noarch java-1.8.0-openjdk-devel-1.8.0.181-3.b13.el7_5.x86_64 javapackages-tools-3.4.1-11.el7.noarch java-1.8.0-openjdk-headless-1.8.0.181-3.b13.el7_5.x86_64 java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64

//删除

[root@ycj ~]# rpm -qa | grep java //检查

 

 

==安装jdk1.8==

[root@ycj ~]# mkdir -p /usr/local/src/jdk  

//创建目录

[root@ycj jdk]# cd /usr/local/src/jdk

[root@ycj jdk]# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz

//获取源码包,--no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"是为了避开用户验证

 

[root@ycj jdk]# tar -zxvf jdk-8u131-linux-x64.tar.gz

//解压

[root@ycj jdk]# mv jdk1.8.0_131 jdk1.8 //改名

[root@ycj jdk]# vi /etc/profile //编辑环境变量

export JAVA_HOME=/usr/local/src/jdk/jdk1.8

export PATH=$PATH:$JAVA_HOME/bin

[root@ycj jdk]# source /etc/profile //刷新

[root@ycj jdk]# javac //验证

 

 

 

 

 

 

 

 

 

转载请注明原文地址: https://www.6miu.com/read-4150209.html

最新回复(0)