I haven't attempted the fix using the terminal.
What I might suggest is re-installing Java using the "Offline" standalone Java installer. There's a choice of a few. The one the article suggested is this one:
http://www.apple.com/support/downloa...acosx1039.html
However, I've found most people seem to get it fixed using this one:
http://www.apple.com/downloads/macos...update142.html
If it doesn't allow you to install it, then remove the java142.pkg from the Receipts folder. You'll find it here
Receipts folder sample image