Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 972  / 2 Years ago, sat, october 29, 2022, 9:03:01

I want to have two JDKs. The first one was installed a long time ago to /usr/lib/jvm/java-7-oracle/. I installed the second version and executed following commands to add it to alternatives:



red-planet@laptop:~$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java_1.6.0_35/bin/java" 2
update-alternatives: using /opt/java_1.6.0_35/bin/java to provide /usr/bin/java (java) in auto mode.
red-planet@laptop:~$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/java_1.6.0_35/bin/javac" 2
update-alternatives: using /opt/java_1.6.0_35/bin/javac to provide /usr/bin/javac (javac) in auto mode.
red-planet@laptop:~$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/java_1.6.0_35/bin/javaws" 2
update-alternatives: using /opt/java_1.6.0_35/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode.


And configured:



There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
* 0 /opt/java_1.6.0_35/bin/java 2 auto mode
1 /opt/java_1.6.0_35/bin/java 2 manual mode
2 /usr/lib/jvm/java-7-oracle/bin/java 1 manual mode

Press enter to keep the current choice[*], or type selection number:


Why do I have two equal items in the list?


More From » jdk

 Answers
6

The selection marked as 0 is not a duplicate, it just indicates what is currently the alternative with the highest priority, and therefore the one that will be used in auto mode.
In Auto mode whenever you add a new alternative the system always uses the one with the highest priority. In manual, the system honors your choice even if a higher priority alternative is available.
You can choose auto mode by selecting 0 at that prompt, or manual by entering the number corresponding to any of the alternatives. Look at the man page for more details


[#35101] Sunday, October 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ippalogu

Total Points: 215
Total Questions: 127
Total Answers: 146

Location: Denmark
Member since Tue, Jul 19, 2022
2 Years ago
ippalogu questions
Tue, Jan 4, 22, 21:49, 2 Years ago
Tue, Sep 21, 21, 09:12, 3 Years ago
Wed, May 19, 21, 02:24, 3 Years ago
Mon, Dec 27, 21, 01:44, 2 Years ago
;