我在我的电脑上安装了 Oracle 的 Java CentOS Linux release 7.0.1406 (Core)
:
[alexus@wcmisdlin02 Desktop]$ rpm -q jdk1.8.0_25-1.8.0_25-fcs
jdk1.8.0_25-1.8.0_25-fcs.x86_64
[alexus@wcmisdlin02 Desktop]$
但是,alternatives
没有看到:
[alexus@wcmisdlin02 Desktop]$ sudo alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71-2.5.3.1.el7_0.x86_64/jre/bin/java
2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
Enter to keep the current selection[+], or type selection number:
我有点困惑如何使用alternatives --install
动作,有人可以帮我一下吗?
提前致谢!
答案1
我按照这个步骤安装了 java jre,您可以对 jdk 执行相同的步骤。
tar xvfz jre-8u25-linux-i586.tar.gz
mv jre1.8.0_25/ /opt/
usage: alternatives --install <link> <name> <path> <priority>
alternatives --install /usr/bin/java java /opt/jre1.8.0_25/bin/java 2
alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /opt/jre1.8.0_25/bin/java