6

On my Ubuntu 15.04, sudo update-alternatives --config java shows:

Selection    Path                                               Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-oracle/jre/bin/java             1074      auto mode
  1            /opt/java32/jdk1.7.0_71/jre/bin/java                1         manual mode
  2            /usr/lib/jvm/java-1.7.0-openjdk-i386/jre/bin/java   10        manual mode
  3            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java      1071      manual mode
  4            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java       1070      manual mode
* 5            /usr/lib/jvm/java-8-oracle/jre/bin/java             1074      manual mode

Why is the single path, /usr/lib/jvm/java-8-oracle/jre/bin/java having two entries, one in auto and the other in manual mode?

Even though both the paths have same priority 1024, and the manual path is marked as the default one. Does manual mode always have higher preference over auto mode?

terdon
  • 234,489
  • 66
  • 447
  • 667

1 Answers1

4

The entry marked with * signifies the current selection. It is the default only in the sense as you do not have to enter anything in update-alternatives if you do not want to change it.

The system default is always auto, which means that the setting will change to always choose the alternative with the highest priority, determined by the package maintainers. The asterisk appearing in a manual line means that someone has changed the alternative. The system will not alter this choice, even when priorities are changing when updates are installed. So yes, manual mode always has preference over auto mode. Apparently, someone has (manually!) changed the setting for the java binary, but the current alternative is still the same as would be chosen by the system in auto mode, therefor the entry is appearing twice.

If you would prefer to let the system choose the "best" alternative for the java path automatically, select 0 here. Be aware that especially Java applications might be picky about the used implementation and version, so be careful what you change. Java applications that are available from the Debian or Ubuntu repositories, respectively, should always be able to run with the default JRE.

Dubu
  • 3,654
  • 18
  • 27