How to completely remove Java installation from Ubuntu

Here is a simple terminal command that removes Java installations from Ubuntu installation easily.

So you’ve had enough  of Java on your Ubuntu installation and want to remove it all from your PC. The default way of uninstalling on Ubuntu with (apt-get remove) removes the current installation and tries to install the default version. And because we don’t want that anymore, we need Java out of the system.

If you have removed Java from your system you will get the following message from the command when you try to run “java”. The Ubuntu offers you to install java from the list of packages if you want to install Java again.


Here is a simple command that does this simple and easily.

sudo apt-get purge icedtea-* openjdk-*

This searches for openjdk installation and icedtea plugin installation and removes it from the system permanently without the need to download any other packages in the process.

After you’ve run that command successfully, you can clean the obsolete packages that you don’t need any more by the following command.

sudo apt-get autoremove


And you’ve just removed the OpenJDK, JRE and Icedtea Java installation from your Ubuntu operating system.

Leave a Reply