JDK on OSX 10.7 Lion
Asked Answered
U

5

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?

Untoward answered 7/7, 2011 at 17:7 Comment(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.Coastwise
But what's the source and documentation path?Grouty
Z
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
Zaslow answered 22/7, 2011 at 4:5 Comment(4)
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.frameworksOccurrence
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. ThanksAlabaster
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"Stribling
found java in /System/Library/Frameworks/JavaVM.framework/Home/bin/Herbartian
I
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

Ivers answered 14/7, 2011 at 8:57 Comment(0)
S
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
Stefanstefanac answered 20/7, 2011 at 21:44 Comment(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).Forepart
T
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.

Tripedal answered 9/9, 2012 at 19:58 Comment(0)
P
1

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

Wish it helps

Photosphere answered 31/7, 2014 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.