How to uninstall OpenJDK?
I don't want OpenJDK
installed on my Ubuntu 13.04 system, but trying to uninstall the openjdk-7-jre
yields the following message:
$ sudo apt-get purge openjdk-7-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
gcj-4.7-base gcj-4.7-jre gcj-4.7-jre-headless gcj-4.7-jre-lib gcj-jre gcj-jre-headless icedtea-6-jre-cacao icedtea-6-jre-jamvm libgcj-common libgcj13 libgcj13-awt
openjdk-6-jre-headless openjdk-6-jre-lib
Suggested packages:
fastjar gcj-4.7-jdk gcj-jdk libgcj13-dbg sun-java6-fonts fonts-ipafont-gothic fonts-ipafont-mincho ttf-telugu-fonts ttf-oriya-fonts ttf-kannada-fonts
ttf-bengali-fonts
The following packages will be REMOVED:
default-jre* icedtea-7-plugin* icedtea-netx* icedtea-plugin* libatk-wrapper-java* libatk-wrapper-java-jni* openjdk-7-jre*
The following NEW packages will be installed:
gcj-4.7-base gcj-4.7-jre gcj-4.7-jre-headless gcj-4.7-jre-lib gcj-jre gcj-jre-headless icedtea-6-jre-cacao icedtea-6-jre-jamvm libgcj-common libgcj13 libgcj13-awt
openjdk-6-jre-headless openjdk-6-jre-lib
0 upgraded, 13 newly installed, 7 to remove and 4 not upgraded.
Need to get 57,0 MB/57,2 MB of archives.
After this operation, 156 MB of additional disk space will be used.
Do you want to continue [Y/n]?
What do I need to do so that no new packages, of which I need none, will be installed when removing openjdk-7
?
Solution 1:
Great question, I was wondering this myself.
I found that you can use the following to remove the openjdk-7-jre on Ubuntu 13.04:
sudo apt-get autoremove openjdk-7-jre
Press 'y' and then press enter when prompted to confirm this change. This should also clean up all the additional dependency libraries that were installed with it.
I also found you can use the following command to perform additional clean up:
sudo apt-get purge openjdk*
If you use the following command:
java -version
You should no longer see the openjdk-7-jre installed!
Hope this helps. :)
Solution 2:
You can use the following command:
sudo apt-get purge openjdk-8-jre openjdk-8-jre-headless openjdk-7-jre gcj-4.7-base gcj-4.7-jre openjdk-6-jre-headless
In this way no new packages will be installed. Here is my output for the above command:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'gcj-4.7-base' is not installed, so not removed
Package 'gcj-4.7-jre' is not installed, so not removed
Package 'openjdk-6-jre-headless' is not installed, so not removed
The following packages will be REMOVED:
default-jre* icedtea-7-plugin* icedtea-netx* libatk-wrapper-java*
libatk-wrapper-java-jni* libreoffice-base* minecraft-installer*
openjdk-7-jre*
0 upgraded, 0 newly installed, 8 to remove and 6 not upgraded.
After this operation, 10,3 MB disk space will be freed.
Do you want to continue [Y/n]? n
But, I don't suggest you to do this. In one day you will need for sure an OpenJDK (6 or 7).