How to Install Java (and JDK) on Mac OS X Lion
Thursday February 9th, 2012
One of my favorite things on the Mac was having a recent version of Java and a Java Development Kit (JDK) pre-installed on Mac OS X until the release of version 10.7 Lion. On Snow Leopard, the 64-bit version of Java 6 came already installed.
With MacOS X Lion, however, Java does not come out-of-the-box and you have to download and install it manually (or via the Apple Software Update) – except in rare cases where you upgraded from Snow Leopard to Lion.
The first package of Java 6 for Mac OS X Lion for download & manual installation can be found on the following link: http://support.apple.com/kb/DL1421
The download size is about 62.5 MB and gets you Java SE version 1.6.0_26 (64-bit of course). Although this one is not be the most up-to-date version, once you have it on your system, you would be prompted to upgrade automatically next time Apple Software Update is run.
As for JDK 7 for Mac, it will be available directly from Oracle, maybe even through the App Store – no official announcement on the latter, though, so far, but stay tuned for good news!
If you are a Java developer who wants to do Java development on Mac OS X 10.7, here are a few not-so-tricky steps to follow to get going:
- Go to http://connect.apple.com and sign in with your Apple ID (developer account may be required – it’s free).
- From the list titled “Downloads for Apple Developers”, select the item labeled “Java for Mac OS X 10.7 Update 1 Developer Package” (release date Nov 8, 2011) then download and install the package.
- The JDK will be installed into a different location then previous. This will result in IDEs (such as Eclipse) being unable to locate source code and java docs.
- At the time of writing the JDK ended up here:
/Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home - Open up Eclipse preferences and go to Java > Installed JREs page
- Rather than use the “JVM Contents (MacOS X Default) we will need to use the JDK location
- At the time of writing Search is not aware of the new JDK location; we we will need to click on the Add button
- From the Add JRE wizard choose “MacOS X VM” for the JRE Type
- For the JRE Definition Page we need to fill in the following:
JRE Home: /Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home - The other fields will now auto fill, with the default JRE name being “Home”. You can quickly correct this to something more meaningful such as:
JRE name: System JDK - Finish the wizard and return to the Installed JREs page
- Choose “System JDK” from the list
- You can now develop normally with:
- javadocs correctly shown for base classes
- source code correctly shown when debugging
Why Java no longer pre-installed on Macs?
What has happened is Apple has quit mangling their own JDK into the OS and delegating responsibility to Oracle to supply a JDK for OSX going forward. It isn’t installed by default, but after the fact just like on every other platform other than Solaris. Arguably this will be a good thing, as the Apple JDK usually lagged like 6 months behind the official Sun/Oracle one.
Original Press Release
As of the release of Java for Mac OS X 10.6 Update 3, the version of Java that is ported by Apple, and that ships with Mac OS X, is deprecated. This means that the Apple-produced runtime will not be maintained at the same level, and may be removed from future versions of Mac OS X. The Java runtime shipping in Mac OS X 10.6 Snow Leopard, and Mac OS X 10.5 Leopard, will continue to be supported and maintained through the standard support cycles of those products.
Mac OS X Lion For Dummies (For Dummies (Computer/Tech))
Mac OS X Lion: The Missing Manual
Related posts:









On newer versions of OS X you should find ALL JREs (and JDKs) under
/Library/Java/JavaVirtualMachines/
/System/Library/Java/JavaVirtualMachines/
the old path
/System/Library/Frameworks/JavaVM.framework/
has been deprecated.
Here is the official deprecation note:
http://developer.apple.com/library/mac/#releasenotes/Java/JavaSnowLeopardUpdate3LeopardUpdate8RN/NewandNoteworthy/NewandNoteworthy.html#//apple_ref/doc/uid/TP40010380-CH4-SW1
Alternatively, you can open a Terminal window, and type the command: javac -v; then Mac OS X Lion will suggest you to install Java, you just click ‘yes’, and then the Apple Software Update will download and install Java automatically for you.
Netbeans 7.01 just worked fine after following your instructions. Eclipse Indigo has serious problems, but I’m not sure if it’s a Mac (Lion) thing or it’s just Eclipse itself.
Thank you, Maclord. I couldn’t find a “jre”, so I didn’t know what to tell Eclipse. Your info was just what I needed.