JDK on OSX 10.7 Lion

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?


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

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

  • 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.

  • 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:

  • 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

  • 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


    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
    
    链接地址: http://www.djcxy.com/p/33310.html

    上一篇: Git不适用于雪豹

    下一篇: JDK在OSX 10.7 Lion上