How to completely remove a oracle jdk that didn't install properly?

I was having the same problem on Ubuntu 11.10, tried all of the same solutions, none of which worked for me either. I found this on another discussion board and it appears to have worked for me:

If you want to remove oracle-jdk7-installer, you can simply go to /var/lib/dpkg/info/ It takes some time to load, and delete all files which starts with oracle-java7***** there was ~6files, then go to Synaptic and simply locate same oracle-jdk and click remove/completly remove.

This is where I found it: http://ubuntuforums.org/showthread.php?p=11821814

Good luck!

Edit: here are the 3 steps to easily do this:

Open a terminal (ctrl + alt + T) and type those two commands successively:

cd /var/lib/dpkg/info/
sudo rm oracle-java7-installer*

Open synaptic, search for "oracle-java7-installer", mark it for complete removal and click "apply".

Edit: For those that don't have synaptic installed, after you rm the oracle installer files, just do:

sudo apt-get purge oracle-java7-installer

And you should be good.

edit: worked on ubuntu 12.04 LTS as well


Add webupd8 ppa again

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Open the terminal and type:

  sudo apt-get update
  sudo apt-get install -f

Then purge the ppa using ppa purge

sudo apt-get install ppa-purge
sudo ppa-purge ppa:webupd8team/java

Links

  1. Why is 'ppa-purge' not installed by default?
  2. http://www.webupd8.org/2009/12/remove-ppa-repositories-via-command.html
  3. http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
  4. Are PPA's safe to add to my system and what are some "red flags" to watch out for?

Try

sudo apt-get purge <package>

Hope this works!