0

I tried the following command:

$java --version
openjdk 11.0.27 2025-04-15
OpenJDK Runtime Environment (build 11.0.27+6-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.27+6-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

hence I tried:

$sudo apt autoremove
[sudo] password for ********: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  chromium-codecs-ffmpeg-extra default-jdk-headless gstreamer1.0-vaapi gyp
  i965-va-driver intel-media-va-driver javascript-common libaacs0 libass9
  libavcodec58 libavformat58 libavutil56 libbdplus0 libblas3 libbluray2
  libbs2b0 libchromaprint1 libcodec2-1.0 libflashrom1 libflite1 libftdi1-2
  libgme0 libgsm1 libgstreamer-plugins-bad1.0-0 libigdgmm12 libjs-events
  libjs-highlight.js libjs-inherits libjs-is-typedarray libjs-psl
  libjs-source-map libjs-sprintf-js libjs-typedarray-to-buffer liblilv-0-0
:
:
Removing libva2:amd64 (2.14.0-1) ...
Removing libvdpau1:amd64 (1.4-3build2) ...
Removing node-minimatch (3.1.1+~3.0.5-1) ...
Removing node-brace-expansion (2.0.1-1) ...
Removing node-balanced-match (2.0.0-1) ...
Removing node-fs.realpath (1.0.0-2) ...
Removing node-inflight (1.0.6-2) ...
Removing node-once (1.4.0-4) ...
Removing node-path-is-absolute (2.0.0-2) ...
Removing node-wrappy (1.0.2-2) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.9) ...

Then I typed:

$apt remove default-jdk-headless

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

$ rm openjdk-11-jre

rm: cannot remove 'openjdk-11-jre': No such file or directory zulfikar@lc2530:~$ rm openjdk-11-jre-headless rm: cannot remove 'openjdk-11-jre-headless': No such file or directory

I can't still remove Java because I am getting

$ java --version
openjdk 11.0.27 2025-04-15
OpenJDK Runtime Environment (build 11.0.27+6-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.27+6-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

Somebody please guide me.

Zulfi.

user2994783
  • 235
  • 3
  • 6
  • 16

1 Answers1

0

I found the following solution at : [[reddit.com/r/Ubuntu/comments/1kshg89/ubuntu_2204_removing_java][1]][1] (worked)

user@lc2530:~$ dpkg --get-selections | grep java

ca-certificates-java install gir1.2-javascriptcoregtk-4.0:amd64 install java-common install javascript-common deinstall libatk-wrapper-java install libatk-wrapper-java-jni:amd64 install libjavascriptcoregtk-4.0-18:amd64 install

user@lc2530:~$ sudo apt remove java-common

(worked) –

user2994783
  • 235
  • 3
  • 6
  • 16