• centos jdk 1.7升级到1.8后显示还是1.7


    系统原来安装的是jdk 1.7,现在要升级到1.8,查看了一下,原来是通过解压的方式安装的,
    现在重新按这种方式安装1.8

    1 下载jdk1.8
    http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
    找到下载链接
    然后在linux中:

    wget http://111.1.50.111/files/323000000641B15B/download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
    --2017-11-04 16:58:18--  http://111.1.50.111/files/323000000641B15B/download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
    Connecting to 111.1.50.111:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 189736377 (181M) [application/octet-stream]
    Saving to: ‘jdk-8u151-linux-x64.tar.gz100%[=======================================================================================================>] 189,736,377 13.6MB/s   in 15s    
    
    2017-11-04 16:58:32 (12.5 MB/s) - ‘jdk-8u151-linux-x64.tar.gz’ saved [189736377/189736377]
    [root@izwz95v28cpic4beuk0rk0z java]# ls
    jdk1.7.0_79  jdk-7u79-linux-x64.tar.gz  jdk-8u151-linux-x64.tar.gz

    下载成功.

    tar -xzvf  jdk-8u151-linux-x64.tar.gz
    [root@izwz95v28cpic4beuk0rk0z java]# ls
    jdk1.7.0_79  jdk1.8.0_151  jdk-7u79-linux-x64.tar.gz  jdk-8u151-linux-x64.tar.gz
    [root@izwz95v28cpic4beuk0rk0z jdk1.8.0_151]# pwd
    /usr/java/jdk1.8.0_151
    vim  /etc/profile
    
    # java env
    # java env
    JAVA_HOME=/usr/java/jdk1.8.0_151
    PATH=$PATH:${JAVA_HOME}/bin
    CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
    export PATH JAVA_HOME CLASSPATH
    root@izwz95v28cpic4beuk0rk0z jdk1.8.0_151]# java -version
    java version "1.7.0_79"

    查看Jdk版本还是1.7,最后发现PATH应该这样写:

    PATH=${JAVA_HOME}/bin:$PATH
    
    要把$JAVA_HOME/bin放在前面,不然使用java命令时,系统会找到以前 的java
  • 相关阅读:
    spring常用注解
    P1255 数楼梯
    蓝桥杯 传纸条(动态规划)
    蓝桥杯 数的划分两种解法
    蓝桥杯 数独
    Elasticsearch05-批量增删改查
    Elasticsearch04-正排索引和倒排索引
    Elasticsearch03-Mapping和聚合
    Elasticsearch02-查询语法
    亿级流量多级缓存高并发系统架构实战
  • 原文地址:https://www.cnblogs.com/luleiitlife/p/8544978.html
Copyright © 2020-2023  润新知