Score:0

Made mistake with update-alternatives

pr flag

I'm trying to run Amidst. That's a mapping tool for Minecraft worlds, for those that don't know. That got me fiddling with java versions and JDKs and JREs and I don't quite know what I'm doing.

I'm on Ubuntu 20.04. In trying to get it to use Java 19 and not "Open With OpenJDK Java 11 Runtime" that's the only thing in the right-click 'Open With Other Application' menu (which is probably going to end up the subject of an entirely different question), I started following the instructions from this link: https://ubuntuhandbook.org/index.php/2022/03/install-jdk-18-ubuntu/

I got to section 3a, where it says "Similarly, add links for other executable files (e.g., jarsigner, jlink, javadoc) as you need."

So I ran this:

(base) preston@theseus:~$ sudo update-alternatives --install /usr/bin/jarsigner java /usr/lib/jvm/jdk-19/bin/jarsigner 1
update-alternatives: renaming java link from /usr/bin/java to /usr/bin/jarsigner

I didn't like the look of that output. It turns out that the following commands now give these outputs:

(base) preston@theseus:~$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/jarsigner).

  Selection    Path                                         Priority   Status
---------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      manual mode
  2            /usr/lib/jvm/jdk-19/bin/jarsigner             1         manual mode
* 3            /usr/lib/jvm/jdk-19/bin/java                  1         manual mode

Press <enter> to keep the current choice[*], or type selection number:
(base) preston@theseus:~$ java -version

Command 'java' not found, but can be installed with:

sudo apt install openjdk-11-jre-headless  # version 11.0.17+8-1ubuntu2~20.04, or
sudo apt install default-jre              # version 2:1.11-72
sudo apt install openjdk-16-jre-headless  # version 16.0.1+9-1~20.04
sudo apt install openjdk-17-jre-headless  # version 17.0.5+8-2ubuntu1~20.04
sudo apt install openjdk-8-jre-headless   # version 8u352-ga-1~20.04
sudo apt install openjdk-13-jre-headless  # version 13.0.7+5-0ubuntu1~20.04
(base) preston@theseus:~$ echo $JAVA_HOME
/usr/lib/jvm/jdk-19

How do I reverse this? I have seen the question here (how fix mistake made with update-alternatives?), but the solution there is for something just different enough that I decided to ask my own question.

kanehekili avatar
zw flag
what happens if you call "update-alternatives" and select "0"? It should be java-11 again.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.