As I recall, the first time you do something that needs Java the OS will ask if you want to install it, and version 6 is what you get. According to this page, typing java -version
in the Terminal is enough to trigger the prompt.
For the JDK (and not the runtime), you’ll need to log into developer.apple.com, search for java
, and download the Java for OS X 2012-006 Developer Package. I just did this on my MacBook and now have javac 1.6.0_37
.