Possible Duplicate:
Source code for Mac OS X java version 1.6.0_22
I’ve been developing a web app using Java EE 6. At work I’m using Netbeans on Windows 7. I always took it for granted that I could view the Java SE 6 source by, say, ctrl-clicking on String and seeing the code.
Recently I installed Netbeans on my macbook at home (Mac OS X 10.6.5) and downloaded the project. Everything’s working fine, but I noticed I can’t view the source of the standard java classes any more. All methods have the throw new RuntimeException("Compiled Code"); in them.
What’s missing that I need to install here?
Update: Okay, after reading this discussion I went to http://connect.apple.com/ and downloaded/installed Java for Mac OS X 10.6 Update 5 Developer Package (also had to update OSX to 10.6.8). However, I still can’t view the source in Netbeans. How do I configure Netbeans so the Java SE 6 source is viewable?
Update 2: I’ve been using http://javasourcecode.org/ in the meantime, but it would still be better to view the source in Netbeans.
Update 3: it looks like if I go to Tools->Java Platforms->Sources I can choose the source to read from. I tried selecting /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/1.6.0_26-b03-384.jdk but this didn’t work, which I guess makes sense since this is the default platform.
I keep reading everywhere that I should find the .jar I need at /Library/Java/Home/src.jar but it isn’t there. A Spotlight search for src.jar or src.zip turns up blank. Can someone please help me fill in the blanks here?
Found the answer in this post: Source code for Mac OS X Java Updates Not sure why I didn’t find it earlier as I searched pretty extensively – must have used the wrong keywords.
Apparently it’s now located at
/Library/Java/JavaVirtualMachines/1.6.0_26-b03-384.jdk/Contents/Home/src.jar. My mistake was not opening the package contents of1.6.0_26-b03-384.jdk.