0

Inside a Debian 10 VM I have first installed OpenJDK 11, and it was all OK. Then I have installed Oracle JDK 13 according to instructions posted in Computing for geeks, that means wget-ting the .deb file and install it with dpkg -i.

I have got no errors, but when running update-alternatives --config java I get this answer:

There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java

Why? How can I switch from one JDK to the other?

2

The alternatives are handled by pre- and post-install hooks. There seems to be no hook included in the package you downloaded, but you can easily add an alternative manually:

# update-alternatives --install /usr/bin/java java /path/to/OracleJDKs/java 2
# update-alternatives --install /usr/bin/javac javac /path/to/OracleJDKs/javac 2

Afterwards you should be able to select a Java version by running update-alternatives --config java and update-alternatives --config javac.

However, the java-package package always provided an easy way to install Oracle JDK on a Debian system. Since I have not used it for quiet a while I can not say if it is still compatible with current Java releases.

3
  • :Doesn't work. After entering these command (with sudo), I'm still getting a "There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java ". Needless to say I've modified paths to java-11-jdk because it's the one I actually have.
    – Sandman42
    Oct 2 '19 at 10:08
  • Sorry my mistake: you have to adapt the third parameter to point to Oracle JDK's java and javac binaries .
    – dirdi
    Oct 2 '19 at 10:12
  • Yeah, it works. Thanks!
    – Sandman42
    Oct 2 '19 at 10:15

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.