I have Java 11 and 8 in my Ubuntu 18.04, side by side. I mean to set Java 8 as the default.
What I get:
$ sudo update-java-alternatives --set /usr/lib/jvm/java-1.8.0-openjdk-amd64
update-alternatives: error: no alternatives for mozilla-javaplugin.so
update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/lib/IcedTeaPlugin.so
How can I get both plugins if they exist, work.
I am not sure if using (see this)
sudo update-java-alternative —jre-headless -s java-1.8.0-openjdk-amd64
is ok, so I did not try it.
Could it break anything?
The Following are results after update-java-alternatives
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1101 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
This is the opposite change from
update-alternatives: error: no alternatives for mozilla-javaplugin.so
https://ubuntuforums.org/showthread.php?t=2402155
Related:
https://serverfault.com/questions/814064/set-jdk-8-as-the-default-java-on-debian-8
You can select the default Java Version by running the following command:
Select the Java Installation you want to use per default by typing the selection number. Check the default Java Version by running
java -version
. It should print something similar to the following:jre-headless
is okay if the java app you want to run has no gui.has potential inconsistent java env issue. See Setting JDK 7 as default