0

I have Ubuntu 22.04 installed on a Virtualbox VM running on Windows 10.

I have to switch the current version of Java installed on my Ubuntu to Java 17, which is the most recent version guaranteed to work fine with some software I need to use.

So I have tryed to uninstall the actual version of Java (Java 11, and before I did it for Java 18).

In order to do so, I have followed this procedure of @Eric Carvalho.

Unfortuately, It also removed some OS files from Ubuntu, and now my VM does not work well anymore.

Luckily I had a backup of the whole VM on Windows ( C > users > MYUSER > VirtualBox VMs ), so I deleted the modified VM and started anew.

So now, How can I safely upgrade/switch from any version of Java to Java 17 on Ubuntu 22.04 ?

Tms91
  • 365

1 Answers1

0

I have re-done the procedure indicated in the question, but instead of runnning

dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge

I have runned

dpkg -l | grep ^rc | awk '{print($2)}'

It prints a list of path.
Select only the having 'java' and 'jdk' in the name.
In my case they are the following ones:

  1. ca-certificates-java

  2. java-common

  3. openjdk-11-jre-headless:amd64

Put them as arguments of

sudo apt-get purge <target>

so , in my case:

sudo apt-get purge ca-certificates-java
sudo apt-get purge java-common
sudo apt-get purge openjdk-11-jre-headless:amd64

then I went on with the other steps of the procedure, until I got to its end.

Finally I rebooted my PC
and installed Java 17, with the following command

sudo apt update
sudo apt install openjdk-17-jdk
Tms91
  • 365