先删除centos自带的openjdk

查看当前系统的jdk

[parallels@10 program]$ rpm -qa | grep java

tzdata-java-2018e-3.el7.noarch

java-1.7.0-openjdk-1.7.0.191-2.6.15.4.el7_5.x86_64

javapackages-tools-3.4.1-11.el7.noarch

java-1.7.0-openjdk-headless-1.7.0.191-2.6.15.4.el7_5.x86_64

java-1.8.0-openjdk-headless-1.8.0.181-3.b13.el7_5.x86_64

python-javapackages-3.4.1-11.el7.noarch

java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64

 

卸载删除

[parallels@10 program]$ sudo  rpm -e --nodeps java-1.7.0-openjdk-1.7.0.191-2.6.15.4.el7_5.x86_64

[sudo] parallels 的密码:

[parallels@10 program]$ sudo rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.191-2.6.15.4.el7_5.x86_64

[parallels@10 program]$ sudo rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.181-3.b13.el7_5.x86_64

[parallels@10 program]$ sudo rpm -e --nodeps java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64

 

下载jdk,这里用下载java8为例

下载地址:

https://download.oracle.com/otn/java/jdk/8u261-b12/a4634525489241b9a9e1aa73d9e118e6/jdk-8u261-linux-x64.tar.gz

下载后在目录解压jdk版本

 tar -zxvf jdk-8u261-linux-x64.tar.gz 

修改配置文件

[parallels@10 jdk1.8.0_261]$ sudo vim /etc/profile

在文件末尾增加配置

#java environment

export JAVA_HOME=/home/parallels/program/jdk1.8.0_261

export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar

export PATH=$PATH:${JAVA_HOME}/bin

执行命令,让配置文件立即生效

[parallels@10 jdk1.8.0_261]$ sudo vim /etc/profile

查看java是否成功

[parallels@10 jdk1.8.0_261]$ java -version

java version "1.8.0_261"

Java(TM) SE Runtime Environment (build 1.8.0_261-b12)

Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

119 对 “centos安装jdk”的想法;

  1. What i don’t understood is in reality how you are no longer really
    a lot more smartly-liked than you may be now.
    You’re very intelligent. You understand thus significantly in relation to this topic, produced me individually consider it from numerous various angles.
    Its like men and women are not involved unless it’s something to do
    with Girl gaga! Your personal stuffs outstanding.
    All the time deal with it up! https://www.herpessymptomsinmen.org/where-to-buy-hydroxychloroquine/

  2. Pingback: cialis coupon 2019
  3. It is perfect time to make some plans for the longer term and it is time to be happy.

    I have learn this put up and if I could I desire to counsel you some interesting things or advice.

    Perhaps you can write next articles regarding this article.

    I wish to read more things about it!

  4. Pingback: generic cialis buy
  5. Pingback: viagra super active
  6. Pingback: viagra prices walmart
  7. Pingback: gabapentin anxiety
  8. Pingback: cialis 10mg sale
  9. Pingback: levitra prices usa

发表评论

邮箱地址不会被公开。