0

runing lsb_release -a I get:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:   jammy

when I run: gradle -v I get:

------------------------------------------------------------
Gradle 7.6.4
------------------------------------------------------------

Build time: 2024-02-05 14:29:18 UTC Revision: e0bb3fc8cefad8432c9033cdfb12dc14facc9dd9

Kotlin: 1.7.10 Groovy: 3.0.13 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 22.0.1 (Oracle Corporation 22.0.1+8-16) OS: Linux 6.5.0-35-generic amd64

and runing: java -version

java version "22.0.1" 2024-04-16
Java(TM) SE Runtime Environment (build 22.0.1+8-16)
Java HotSpot(TM) 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)

It turns out that grab 7.6.4 is not compatible with java 22, I need java 19, then I tried to remove java 22 to install java 19 later but I couldn't.

when i run sudo apt autoremove openjdk-22-jre I get:

Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Leyendo la información de estado... Hecho
E: No se ha podido localizar el paquete openjdk-22-jre

when i run sudo apt-get purge openjdk-22 I get:

Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Leyendo la información de estado... Hecho
E: No se ha podido localizar el paquete openjdk-22

running: sudo dpkg --list | grep -i jre

I get:

ii  default-jre                                       2:1.11-72build2                         amd64        Standard Java or Java compatible Runtime
ii  default-jre-headless                              2:1.11-72build2                         amd64        Standard Java or Java compatible Runtime (headless)
ii  openjdk-11-jre:amd64                              11.0.22+7-0ubuntu2~22.04.1              amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-11-jre-headless:amd64                     11.0.22+7-0ubuntu2~22.04.1              amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-8-jre:amd64                               8u402-ga-2ubuntu1~22.04                 amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-8-jre-headless:amd64                      8u402-ga-2ubuntu1~22.04                 amd64        OpenJDK Java runtime, using Hotspot JIT (headless)

1 Answers1

0

the solution was:

To remove Java 22 without the commands you've tried, you can manually uninstall it by deleting the Java directories and updating the alternatives. Here's how you can do it:

  1. Remove Java 22 Manually:

    • Delete the Java directories associated with Java 22:
      sudo rm -rf /usr/lib/jvm/jdk-22
      
    • Remove any remaining Java entries from the alternatives:
      sudo update-alternatives --remove "java" "/usr/lib/jvm/jdk-22/bin/java"
      
  2. Update Alternatives:

    • Update the alternatives for Java to ensure the correct version is used:
      sudo update-alternatives --config java
      sudo update-alternatives --config javac
      sudo update-alternatives --config javaws
      

By following these steps, you can manually remove Java 22 from your system without relying on the commands that didn't work for you previously.

Citations:

[1] https://gist.github.com/lovato/7063928
[2] How to completely uninstall Java?
[3] https://learnubuntu.com/uninstall-java/
[4] https://www.youtube.com/watch?v=OL0a45h0vxQ
[5] https://stackoverflow.com/questions/23959615/how-to-remove-default-jre-java-installation-from-ubuntu

karel
  • 122,292
  • 133
  • 301
  • 332