Uninstall default-jdk
Uninstall default-jdk
I'm on a fresh Ubuntu 18.04 install. I did a sudo apt-get install default-jdk
. Result:
sudo apt-get install default-jdk
java --version
openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1, mixed mode)
Now I did sudo apt-get purge default-jdk
. Result:
sudo apt-get purge default-jdk
java --version
openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1, mixed mode)
Why is OpenJDK still there?
1 Answer
1
default-jdk
in 18.04 has the following description:
default-jdk
Description: Standard Java or Java compatible Development Kit
This dependency package points to the Java runtime, or Java compatible
development kit recommended for this architecture, which is
openjdk-11-jdk for amd64.
The results of apt-cache depends default-jdk
are as follows:
apt-cache depends default-jdk
default-jdk
Depends: default-jre
Depends: default-jdk-headless
Depends: openjdk-11-jdk
The results of apt-cache rdepends default-jdk
show that openjdk-11-jdk does not depend on default-jdk. default-jdk points to a Java runtime or Java compatible development kit, but uninstalling default-jdk does not uninstall either of these packages.
apt-cache rdepends default-jdk
To remove the packages installed by default-jdk, run the following command:
sudo apt remove openjdk-11-jre-headless openjdk-11-jre openjdk-11-jdk-headless openjdk-11-jdk
default-jdk
openjdk-11-jdk
default-jdk
sudo apt-get autoremove
@AndroidDev I replied to your comment by editing my answer. My reply is in the 5th paragraph.
– karel
Sep 17 '18 at 14:31
After
sudo apt-get install default-jdk
I use apt list --installed | grep openj
to see that the packages openjdk-11-jre-headless, openjdk-11-jre, openjdk-11-jdk-headless and openjdk-11-jdk are installed. I use apt list --installed | grep openj
again after a sudo apt-get purge default-jdk
to see that all 4 packages are still there. After sudo apt-get autoremove
the 2 jdk packages are gone but the 2 jre packages are still there!– Robert
Sep 17 '18 at 14:46
sudo apt-get install default-jdk
apt list --installed | grep openj
apt list --installed | grep openj
sudo apt-get purge default-jdk
sudo apt-get autoremove
oh I should add that in the meantime I have done a
sudo apt-get install openjdk-8-jdk
(which has solved my actual problem which I haven't described). So maybe that's the reason why he keeps the jre11 packages despite an autoremove? Which would be weird because why would OpenJDK8 want to have those packages. Anyway, now I have both, default-jdk and openjdk-8-jdk. I switch between the two via sudo update-java-alternatives
.– Robert
Sep 17 '18 at 15:00
sudo apt-get install openjdk-8-jdk
sudo update-java-alternatives
Thanks for contributing an answer to Ask Ubuntu!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy
Since
default-jdk
depends onopenjdk-11-jdk
, then wouldn't removingdefault-jdk
followed by asudo apt-get autoremove
accomplish the same?– Android Dev
Sep 17 '18 at 14:18