zoukankan      html  css  js  c++  java
  • Linux jdk安装多个版本并进行切换

     

    1. 上传jdk7 和 jdk8 包

    2. 解压

    [root@localhost webapps]# tar -zxvf /package/jdk-7u80-linux-x64.tar.gz 

    3. 配置jdk变量

     vi /etc/profile

    export JAVA_HOME=/package/jdk1.7.0_80
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export PATH=$PATH:$JAVA_HOME/bin

    4. java -version

    5. 给jdk1.7设置序列号

    [xxx@localhost home]$ alternatives --install /usr/bin/java java /package/jdk1.7.0_80/bin/java 3

    6. 安装jdk1.8

    [xxx@localhost home]$ alternatives --install /usr/bin/java java /package/jdk1.8.0_124/bin/java 2

    7.选择jdk对应的数字--切换jdk版本

    复制代码
    [root@localhost ~]# java -version
    java version "1.7.0_80"
    Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
    [root@localhost ~]# alternatives --config java
    
    There are 3 programs which provide 'java'.
    
      Selection    Command
    -----------------------------------------------
    *  1           /package/jdk1.8.0_121/java
       2           /package/jdk1.8.0_121/bin/java
     + 3           /package/jdk1.7.0_80/bin/java
    
    Enter to keep the current selection[+], or type selection number: 2
    [root@localhost ~]# java -version
    java version "1.8.0_121"
    Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
    复制代码
  • 相关阅读:
    MyCat 数据库读写分离
    python 网络编程-05 socketserver
    python 网络编程-04 文件的传输
    python 网络编程-03 粘包问题及处理
    常用模块-01getopt
    js获取自动获取本电脑IP
    js变态需求
    js正则不能输入中文和英文
    禁止输入中文
    手机号3-4-5
  • 原文地址:https://www.cnblogs.com/jiawen010/p/13597680.html
Copyright © 2011-2022 走看看