5

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?

dirdi
  • 3,137
  • 14
  • 34
Sandman42
  • 53
  • 1
  • 3

1 Answers1

8

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.

dirdi
  • 3,137
  • 14
  • 34