In early January 2011, I received a Mac OS X Software Update that included Java changes.
This was on a Mac that had been upgraded to Snow Leopard, so older Java setups were still present, but this update must have removed older JVMs and JDKs.
As a result, Eclipse builds would fail with this error:
The container 'JRE System Library [J2SE-1.5]' references non existing library '/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/laf.jar'
In general, the OS X Java setup changed from using
/System/Library/Frameworks/Java.VM.framework/Versions/...
to using a path like
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
After going to Eclipse/Preferences/Java/Installed JREs and "Add..."ing a new JVM that uses the above path with ".../JavaVirtualMachines/..." all is fine again. You might have to look for the full path to that .../Home in a terminal window and copy/paste it into the Eclipse preference dialog, because the "Browse" button in the dialog might only show the 1.6.0.jdk as a package, not as a subdirectory into which you can drill down.
Next issue: You might not have a src.jar in that JDK to be able to view the Java sources, so you cannot view the source code for String, Map, ... and the other standard Java classes. That's because the default JDK is really more like a JRE.
After downloading the Java Development package from the Apple Developer Connection, something like
javadeveloper_10.6_10m3261.dmg
, you get a new JDK in /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk
and that one has a
Content/Home/src.jar
.Note that the JDK that you install yourself, the one that includes the sources, is under /Library/Java/... while the Java stuff that comes with the OS is under /System/Library/Java/...
Eclipse should automatically detect the src.jar in the JDK that you install.
Note on finding the Java Development package as of August 2011:
- http://developer.apple.com/
- Member Center
- Dev Centers: Mac
- Resources
- Mac OS X Developer Downloads
- Java
- Java for Mac OS X ... Developer ...
Thanks so much!
ReplyDeleteI spent a whole day trying to tackle this. Finally got it to work.
Took me awhile to find the file you were talking about, so I thought I would share a link:
ReplyDeletehttp://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/7.1.17.2.1.3.3.1.0.1.1.0.3.9.3.3.1
I had to install the package (Java Developer), then go to eclipse > Preferences > Java > JRE > Search. It found the JRE's between 1.4 and 1.6. I selected 1.6 and eclipse stopped whining.
@Logan: Yes, finding the file takes some time because
ReplyDeletea) You have to log into the Apple Developer Connection. The account is free, but still: Without an account you can't get to the files.
b) You might want the 'latest', or an older 'stable' one, so any links valid today for me won't do it for you.