Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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

share|improve this answer
add comment

It looks like you executed the install java command twice

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.