1. You need to remove JDK first
Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:*
/Library/Java/JavaVirtualMachines/jdk<major>.<minor>.<macro[_update]>.jdk
For example, to uninstall 7u6:
rm -rf jdk1.7.0_06.jdk
2. Remove Java Applet Plugin
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
3. Re-enable the Apple-provided Java SE 6 web plug-in and Web Start features
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.
sudo mkdir -p /Library/Internet\ Plug-Ins/disabled sudo mv /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin /Library/Internet\ Plug-Ins/disabled sudo ln -sf /System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Commands/javaws /usr/bin/javaws
4. Install Apple provided Java 6
Download it here and install it:
http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US