标签:strong cal 场景 ide 优先 运用 and 实例 alter
Java运用于执行java程序(java运行环境) # source ~/.bash_profile
注意需要注释掉/etc/profile文件里面的JAVA_HOM
查看及管理JAVA_HOME
/usr/local/jdk
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
#实例
[cqs@centos7 jdk]$echo ’export JAVA_HOME=/usr/bin/java’ >>~/.bash_profile
[cqs@centos7 jdk]$ echo ‘export PATH=$PATH:$JAVA_HOME/bin’ >>~/.bash_profile
[cqs@centos7 jdk]$ source ~/.bash_profile
注意需要注释掉/etc/profile文件里面的JAVA_HOM
[cqs@centos7 jdk]$ echo $JAVA_HOME
/usr/bin/java
[cqs@centos7 jdk]$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/sbin:/home/cqs/.local/bin:/home/cqs/bin:/usr/bin/java/bin
步骤一:alternatives安装JDK1.7(链接路径【link】:/usr/bin/java 链接名【name】:java 应用程序JAVA实际路径【path】:/home/cqs/data/jdk/jdk1.7.0_80/bin/java 优先级【priority】 :1)
[cqs@centos7 jdk]$ sudo alternatives --install /usr/bin/java java ~/data/jdk/jdk1.7.0_80/bin/java 1
[cqs@centos7 jdk]$ sudo alternatives --config java
There is 1 program that provides ‘java‘.
Selection Command
*+ 1 /home/cqs/data/jdk/jdk1.7.0_80/bin/java
Enter to keep the current selection[+], or type selection number:
[cqs@centos7 jdk]$ 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)
alternatives安装JDK1.8
[cqs@centos7 jdk]$ sudo alternatives --install /usr/bin/java java ~/data/jdk/jdk1.8.0_161/bin/java 2
[cqs@centos7 jdk]$ sudo alternatives --config java
There are 2 programs which provide ‘java‘.
Selection Command
1 /home/cqs/data/jdk/jdk1.7.0_80/bin/java
[cqs@centos7 jdk]$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
[cqs@centos7 jdk]$ sudo alternatives --config java
There are 2 programs which provide ‘java‘.
Selection Command
1 /home/cqs/data/jdk/jdk1.7.0_80/bin/java
*+ 2 /home/cqs/data/jdk/jdk1.8.0_161/bin/java
Enter to keep the current selection[+], or type selection number: 1
[cqs@centos7 jdk]$ 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)
实例场景应用(sun JDK1.7和sun JDK1.8切换alternatives)
标签:strong cal 场景 ide 优先 运用 and 实例 alter
原文地址:https://blog.51cto.com/1929297/2445846