12

I have three JDKs installed, all needed for some projects I work on.

When I run sudo update-alternatives --config java I get the output:

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

  Selection    Path                                     Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-oracle/jre/bin/java   1074      auto mode
  1            /usr/lib/jvm/java-6-oracle/jre/bin/java   1073      manual mode
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java   1074      manual mode
  3            /usr/lib/jvm/java-8-oracle/jre/bin/java   1072      manual mode

How could I make the option 3 (JDK 8) as the one selected in auto mode?

1 Answer 1

12

Make the priority of /usr/lib/jvm/java-8-oracle/jre/bin/java higher that the rest to automatically enable it as default java binary.

You can do:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-oracle/jre/bin/java 1100

Here I have used priority value 1100, actually any value greater that 1074 would do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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