Once more: How to really install Oracle Java on Mac OS X

After upgrading to Mac OS X 10.9 “Mavericks” you may notice that the upgrade also removed any versions of Java you may have had installed. If you’re just using Java Applets in the browser, you can simply go to the Java Download Page, install the offered version of the JRE and be done with it.
If, however, you also need to run local Java apps like for example Eclipse, you’ll get prompted to install Apple’s version of Java. If you do that, this will not only break the browser plugin but also install a version of Java that’s quite outdated and not well maintained by Apple.

The better solution is to download Oracle’s JDK (yup, the complete thing) and make OS X work happily with that. To do this, head over to Oracle’s Java SE download page, click the big button labeled “Java Download” and on the next page accept the License Agreement and select the jdk-7uXX-macosx-x64.dmg for download.
Install by double-clicking on the downloaded file and follow the on-screen instruction. Afterwards open a terminal window and issue

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_XX.jdk /System/Library/Java/JavaVirtualMachines/

(That’s quite a long line above, so make sure to scroll to the right and select everything. Also make sure to replace the ‘XX’ in the version number with the correct version of the JDK you downloaded)

That’s it. From now on Mac OS X 10.9 (and 10.8, for that matter) will work happily with Oracle’s Java and no longer prompt for installing the Apple version.