Search

Wednesday, 8 June 2016

Completely remove Java from Ubuntu 14.04

There maybe many reasons why you might want to remove Java from your system. Whatever the reasons, follow the procedure below to uninstall Java from your Ubuntu system:

Remove all the Java related packages

First run the below three commands one by one to remove all Java related packages like Sun, Oracle, OpenJDK, IcedTea plugins, GIJ:

Purge config files

After removing all the packages you need to purge all the config files. For that run the following command:

Remove cache directory

After purging the config files we need to remove Java config and cache directory from your system. Run the following command to remove the cache directory:

Remove manually installed JVM's

If you have installed any other JVM's then this is the time to remove them. Run the following command:

Remove all leftover Java entries

After uninstalling all the java components from your system some java entries might still be left in your system. To get rid of them run the following command:

Remove java directories from system

This is the final step in removing Java from your system. After uninstalling the java packages the java directories might still be there in your system. To remove them you need to first find if there are any left. Use the following commands to find any leftover directories:

If after running the above script you get any output similar to 'jre1.5/bin/pack200' then run the following command (replace jre1.5 with the directory name that you got in the output at the terminal) to remove the leftover java directory: