Uninstall Java Mountain Lion How do I completely uninstall Java from Mountain Lion?

I wanted to run Minecraft so I followed the system promps and I think I installed Java 7 and then Java 6. I couldn't get Mincraft to work for other reasons so I deleted it and now I want to get rid of Java. 

Not sure if it's relevant but typing "java -version" into Terminal gives me 
"java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)"

Any help would be appreciated.
Apple provides an automatic Java installer but no uninstaller so you can't remove Java once you've installed it without using an at-your-own-risk approach.

That being said this is how to get rid of java from a terminal session and a using a text editor:

sudo rm -rf /System/Library/Java/JavaVirtualMachines/
sudo rm -rf /Library/Java/JavaVirtualMachines/*.jdk
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefpane
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaEssentials.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaEssentials.plist
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaForMacOSX107.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaForMacOSX107.plist
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaMDNS.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaMDNS.plist
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaSecurity.bom
sudo rm -rf /private/var/db/receipts/com.apple.pkg.JavaSecurity.plist


At this point you need to edit the installation history to delete evidence you installed Java.  I suggest backing up the file first.  If you prefer a different text editor feel free to use it but do not use a word processor that puts formatting codes in the text file.

sudo cp /Library/Receipts/InstallHistory.plist ~/Desktop
sudo emacs /Library/Receipts/InstallHistory.plist


Search for entries that look like:

    &lt;dict&gt;
            &lt;key&gt;date&lt;/key&gt;
            &lt;date&gt;2011-09-16T22:22:10Z&lt;/date&gt;
            &lt;key&gt;displayName&lt;/key&gt;
            &lt;string&gt;Java for Mac OS X 10.6 Update 5&lt;/string&gt;
            &lt;key&gt;displayVersion&lt;/key&gt;
            &lt;string&gt;1.0&lt;/string&gt;
            &lt;key&gt;packageIdentifiers&lt;/key&gt;
            &lt;array&gt;
                    &lt;string&gt;com.apple.pkg.JavaForMacOSX10.6Update5&lt;/string&gt;
            &lt;/array&gt;
            &lt;key&gt;processName&lt;/key&gt;
            &lt;string&gt;Software Update&lt;/string&gt;
    &lt;/dict&gt;


also

    &lt;dict&gt;
            &lt;key&gt;date&lt;/key&gt;
            &lt;date&gt;2013-01-15T11:42:35Z&lt;/date&gt;
            &lt;key&gt;displayName&lt;/key&gt;
            &lt;string&gt;Java for OS X 2012-006&lt;/string&gt;
            &lt;key&gt;displayVersion&lt;/key&gt;
            &lt;string&gt;1.0&lt;/string&gt;
            &lt;key&gt;packageIdentifiers&lt;/key&gt;
            &lt;array&gt;
                    &lt;string&gt;com.apple.pkg.JavaEssentials&lt;/string&gt;
                    &lt;string&gt;com.apple.pkg.JavaForMacOSX107&lt;/string&gt;
                    &lt;string&gt;com.apple.pkg.JavaSecurity&lt;/string&gt;
                    &lt;string&gt;com.apple.pkg.JavaMDNS&lt;/string&gt;
            &lt;/array&gt;
            &lt;key&gt;processName&lt;/key&gt;
            &lt;string&gt;Software Update&lt;/string&gt;
    &lt;/dict&gt;


and delete them.  You may wish to check your work using diff:

diff -u ~/Desktop/InstallHistory.plist /Library/Receipts/InstallHistory.plist | less


or some other file comparison tool.

You can test that java is gone by running:

java -version


You should see a pop up asking to install Java again.