Uninstalling Java on Lion
Removing all traces of Java, cleanly, from OS X Lion

Uninstalling Java for Lion is simple. Remove the following directory (which contains the file 1.6.0.jdk):

/System/Library/Java/JavaVirtualMachines/


Then (for completeness), clean up the installer records by removing them from /private/var/db/receipts/:

com.apple.pkg.JavaForMacOSX107.bom
com.apple.pkg.JavaForMacOSX107.plist


And lastly, we clear out any traces of the product installation from Software Update by editing the following plist file: InstallHistory.plist, located in:

/Library/Receipts/


Note: Editing the install history plist file is better done by copying the plist to your desktop (as it owned by root and won't let you modify it), but make sure you restore the default ownership by running the following command:

sudo chown root:admin InstallHistory.plist


You can open the file up in Text Edit and remove the following lines:

&lt;dict&gt;
    &lt;key&gt;date&lt;/key&gt;
    &lt;date&gt;2011-09-06T14:43:35Z&lt;/date&gt;
    &lt;key&gt;displayName&lt;/key&gt;
    &lt;string&gt;Java for Mac OS X 10.7&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;/array&gt;
    &lt;key&gt;processName&lt;/key&gt;
    &lt;string&gt;Software Update&lt;/string&gt;
&lt;/dict&gt;


Additional information

There are two packages that are found in the Java for Mac OS X 10.7 dmg, JavaEssentials and JavaForMacOSX107. The former does not install anything. I have compared the files found on a clean OS X 10.7 install (that does not include Java) and those found in that package, and they are all present and moreover, are identical in every way (v14.0.3). Thus, the only package that needs to be removed is the SDK. Additionally, you can remove the receipts and the install record, but those are more cleanliness than anything. Remove the SDK is sufficient (try running a program that requires Java after the removal of that file, and you will once again be greeted with the notice to install Java).