How to Uninstall Java on Ubuntu

There are 2 options depending on the type of JDK (OpenJDK or Oracle JDK) how to uninstall Java in Ubuntu.

OracleJDK

Check installed Oracle JDK packages:

Remove Java 8:

Removing Java 9:

OpenJDK

First of all, take a look at installed OpenJDK packages:

Depending on installed packages you should edit a list to remove:

Check again for installed packages, the list should be empty:

Java should be completely uninstalled.

Scroll Up