Download from Oracle: http://java.com/en/download/mac_download.jsp?locale=en
Verify that it’s installed properly by looking in System Prefs:
Command-Space to open Spotlight, type ‘System Preferences’, hit enter.
Click Java icon in bottom row. After the Java Control Panel opens, click ‘Java’ tab, ‘View…’, and verify that your install worked. You can see a ‘Path’ there also, which you can sub into the commands below in case they are different than mine.
Verify that the version is as you expect (sub in your path as needed):
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
Create link from /usr/bin/java to your new install
sudo ln -fs /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin/java
Sanity check your version:
java -version