zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    10.16 NOIP模拟赛
    10.14 牛客提高集训营5
    10.12 正睿普及4
    Codeforces Round #516 (Div. 2) (A~E)
    hihoCoder.1509.异或排序(位运算 思路)
    hihoCoder.1513.小Hi的烦恼(bitset 五维偏序)
    hihoCoder挑战赛19 A.Rikka with Sequence(状压DP)
    BZOJ.3668.[NOI2014]起床困难综合症(贪心)
    BZOJ.4903.[CTSC2017]吉夫特(Lucas DP)
    BZOJ.3329.Xorequ(数位DP)
  • 原文地址:https://www.cnblogs.com/luleiitlife/p/8544978.html
Copyright © 2011-2022 走看看