我正在 Linux Debian (Squeeze) 上安装 Apache Solr。我被指示安装 sun-java jdk 1st。然后有人告诉我应该使用命令 sudo update-alternatives --config java
来确保特定的 java (sun-java) 是默认运行时。然而,当我运行这个命令时,我得到:
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/bin/gij-4.4 1044 manual mode
2 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
3 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
Press enter to keep the current choice[*], or type selection number:
那么我应该选择哪个数字将 sun-java 作为默认运行时? 另外,自动和手动模式到底是什么意思?如果我在上面选择 3 并运行 update-alternative 命令,我会收到与上面相同的输出,除了 * 现在在 3 前面之外似乎没有任何变化,尽管它仍然是手动模式。
有没有办法确认我所做的是正确的?
最佳答案
如果您在选择选项后输入“java -version”,您会注意到一个很大的变化。因此,如果您运行 update-alternatives --config java
并选择选项 3
,您将使用 Sun 实现。
此外,关于 auto
与 manual 模式
,根据 this page 进行选择应使其脱离 auto 模式
说明:
When using the
--config
option, alternatives will list all of the choices for the link group of which given name is the master link. You will then be prompted for which of the choices to use for the link group. Once you make a change, the link group will no longer be inauto mode
. You will need to use the--auto
option in order to return to the automatic state.
我相信 auto mode
是在您安装第一个/唯一的 JRE/JDK 时设置的。
关于java - 如何使用命令 update-alternatives --config java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12787757/