67

I've instaled the Java for Developer package provided from Apple for 10.7 and java apps are running fine

but eclipse cannot find the JDK root path and I cant either.

Anybody any ideas?

2
  • I would prefer installing the official JDK from SUN (now it's Oracle). It's really simple, just download from www.java.com, choose the :Linux (self-extracting file) (*.bin). Run the file from terminal to extract it into a location, e.g. ~/jdk1.6/ and then create softlink from /usr/bin/java pointing to the location ~/jdk1.6/bin/java. Not sure if it's applicable for Mac OS though, but you can try.
    – user591593
    Commented Jul 22, 2011 at 5:44
  • 1
    But what's the source and documentation path?
    – user18943
    Commented Jul 26, 2011 at 12:46

5 Answers 5

97

You can download the 10.7 Lion JDK from http://connect.apple.com.

  1. Sign in and click the java section on the right.

  2. The jdk is installed into a different location then previous. This will result in IDEs (such as Eclipse) being unable to locate source code and javadocs.

  3. At the time of writing the JDK ended up here:

    /Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home

  4. Open up eclipse preferences and go to Java --> Installed JREs page

  5. Rather than use the "JVM Contents (MacOS X Default) we will need to use the JDK location

  6. At the time of writing Search is not aware of the new JDK location; we we will need to click on the Add button

  7. From the Add JRE wizard choose "MacOS X VM" for the JRE Type

  8. 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
  9. The other fields will now auto fill, with the default JRE name being "Home". You can quickly correct this to something more meaningful:

    • JRE name: System JDK
  10. Finish the wizard and return to the Installed JREs page

  11. Choose "System JDK" from the list

  12. You can now develop normally with:

    • javadocs correctly shown for base classes
    • source code correctly shown when debugging
4
  • 2
    Well, It seems that javadoc and source is only installed if you installed the Java Developper package (downloaded from connect). I personally upgraded from 10.6 to Lion. When I first launched eclipse, Lion asked we if I wanted to install java. I said yes and got running without any problem. Either it installed a JDK or eclipse somehow managed to use the older versions of java that are to be found in /System/Library/Frameworks/JavaVM.frameworks
    – dodecaplex
    Commented Sep 5, 2011 at 11:57
  • Thanks @HeathBorders for this. I just install Lion and to be able to connect to internet, my EVDO modem need to run its own application, which need to use JDK for Lion. Thanks
    – swdev
    Commented Nov 1, 2011 at 18:13
  • 1
    Looks like there's no longer a java section to the right of connect.apple.com ... Any idea which package should be used? I'm guessing "Java for OS X 2012-006 Developer Package"
    – blong
    Commented Nov 19, 2012 at 14:49
  • found java in /System/Library/Frameworks/JavaVM.framework/Home/bin/
    – alex
    Commented Nov 5, 2013 at 2:40
26

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

0
12

I have just ran into the same problem after updating. The JRE that is downloaded by OSX Lion is missing JavaRuntimeSupport.jar which will work but can wreck havoc on a lot of things. If you've updated, and you had a working JDK/JRE installed prior to that, do the following in Eclipse:

1) Project > Properties > Java Build Path > Select broken JRE/JDK > Edit

2) Select "Alternate JRE"

3) Click "Installed JREs..."

4) In the window that opens, click "Search..."

If all goes well, it will find your older JRE/JDK. Mine was in this location:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
1
  • Can we move this answer down a bit (as it does not provide an out of the box solution that would work for those with a fresh Lion install). Commented Aug 26, 2011 at 8:19
6

For Mountain Lion, Apple's java is up to 1.6.0_35-b10-428.jdk as of today.
It is indeed located under /Library/Java/JavaVirtualMachines .

You just download
"Java for OS X 2012-005 Developer Package" (Sept 6, 2012)
from
http://connect.apple.com/

In my view, Apple's naming is at least a bit confusing; why "-005" - is this the fifth version, or the fifth of five installers one needs?

And then run the installer; then follow the above steps inside Eclipse.

1

You can download jdk6 here http://support.apple.com/kb/DL1573

Wish it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.