Java won't deinstall due to missing program

Here are some stolen notes from: :)

These are useful if you run into error where you can't uninstall Java on a Windows machine (for me Windows 2008 R2 Server). Usually because the Java uninstaller can't find something and usually because multiple versions of Java was installed in the same directory and the 1st copy/version of Java has been already deinstalled but the 2nd version is still there and it can't be removed in the Install Programs Control Panel (because the uninstaller programs are removed)

Using the below can also be a guide in cleaning other programs.

***As always, backup your registry, backup your system! backup your backup...and this can still mess up your system, you have been warned! ****

here are the notes:

reg query hklm\software\classes\installer\products /f "java(tm) 6" /s | find "HKEY_LOCAL_MACHINE" > deljava.txt
for /f "tokens=* delims= " %%a in (deljava.txt) do reg delete %%a /f
del deljava.txt
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\JavaSoft\Java Runtime Environment" /f