如何使用命令update-alternatives --config java [英] How to use the command update-alternatives --config java
问题描述
替代java有3个选择(提供/ usr / bin / java) 。
选择路径优先级状态
---------------------------------- --------------------------
* 0 / usr / lib / jvm / java-6-openjdk / jre / bin / java 1061自动模式
1 /usr/bin/gij-4.4 1044手动模式
2 / usr / lib / jvm / java-6-openjdk / jre / bin / java 1061手动模式
3 / usr / lib / jvm / java-6-sun / jre / bin / java 63手动模式
按回车键保持当前选择[*],或输入选择号码:
那么我应该选择哪个号码将sun-java作为默认运行时?
另外,自动和手动模式究竟是什么意思?如果我选择3以上,并运行update-alternative命令,我将收到与上述相同的输出,再次没有什么似乎已经改变,除了*现在在3的前面,尽管它仍然读取手动模式。有没有办法确认我所做的是否正确?
谢谢,Robert
如果在执行此操作后键入java -version,则选择选项时会注意到一个很大的变化。因此,如果您运行 update-alternatives --config java
并选择选项 3
,那么您将使用太阳实现。
另外,关于 auto
vs 手动模式
选择应该从自动模式
每此页面说明:
使用
- config
选项,备选方案将列出所有的
选项,其中给定名称是主链接的链接组。然后,您将会提示
用于连接
组的哪些选项。一旦您进行更改,链接组将不再是
自动模式
。您需要使用- auto
选项才能将
返回到自动状态。
而且我相信在安装第一个/唯一的JRE / JDK时,会设置自动模式
。
I am installing Apache Solr on Linux Debian (Squeeze). I have been instructed to install sun-java jdk 1st. Then am told that I should use the command sudo update-alternatives --config java to make sure that a particular java (sun-java) is the default runtime. Yet when I run this command I get:
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:
So which number should I select to have sun-java as the default runtime? Also, what exactly do th auto and manual modes mean? If I select 3 above and run the update-alternative command I receive the same output as above, again nothing seems to have changed except that the * is now in front of the 3, though it still reads manual mode. Is there a way to confirm that what I have done is correct?
Thanks, Robert
You will notice a big change when selecting options if you type in "java -version" after doing so. So if you run update-alternatives --config java
and select option 3
, you will be using the Sun implementation.
Also, with regards to auto
vs manual mode
, making a selection should take it out of auto mode
per this page stating:
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.
And I believe auto mode
is set when you install the first/only JRE/JDK.
这篇关于如何使用命令update-alternatives --config java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!