How to use the command update-alternatives --config java(如何使用命令 update-alternatives --config java)
问题描述
我正在 Linux Debian (Squeeze) 上安装 Apache Solr.我被指示安装 sun-java jdk 1st.然后有人告诉我应该使用命令 sudo update-alternatives --config java 来确保特定的 java (sun-java) 是默认运行时.然而,当我运行这个命令时,我得到:
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:
那么我应该选择哪个数字将 sun-java 作为默认运行时?另外,自动和手动模式到底是什么意思?如果我在上面选择 3 并运行 update-alternative 命令,我会收到与上面相同的输出,除了 * 现在在 3 前面之外似乎没有任何变化,尽管它仍然是手动模式.
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?
推荐答案
如果你在选择选项后输入java -version",你会注意到一个很大的变化.因此,如果您运行 update-alternatives --config java
并选择选项 3
,您将使用 Sun 实现.
此外,关于 auto
与 manual 模式
,根据 auto 模式/linux.die.net/man/8/update-alternatives" rel="noreferrer">此页面 声明:
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:
当使用 --config
选项时,替代项将列出所有给定名称为主链接的链接组的选择.你然后将提示您选择哪个选项用于链接团体.进行更改后,链接组将不再位于自动模式
.您需要使用 --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 时设置的.
And I believe auto mode
is set when you install the first/only JRE/JDK.
这篇关于如何使用命令 update-alternatives --config java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用命令 update-alternatives --config java
基础教程推荐
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01