When using Eclipse straight out of the box, if you click on a Java-provided class, like the
FileWriter class, you won't get much help when the Eclipse Class File Editor is shown. All you'll see is some binary information, with these messages at the top of the file:
Source not found The jar file classes.jar has no source attachment. You can attach the source by clicking the Attach Source below:
(The message really should end with "by clicking the Attach Source button below:")
On my Mac OS X laptop, when I click this button I'm prompted to select the location containing the source for
classes.jar. (Sarcasm: Well, if I knew that I wouldn't be here, now would I?)
After a little digging, I found the source code on Sun's website. Specifically, for Mac OS X 10.4.10, which uses Java 5 (JDK 1.5.x, also known as J2SE 5.0 JDK), the source code is available from this page. After following a few more links, this requires an account with Sun to continue, so I created an account, then downloaded a file named
Next, I didn't expand this file, but just moved it to a
Reference folder that I keep in my home directory. Then, back in Eclipse, I specified this file as one containing the Java JVM source code files. As soon as Eclipse finished this process it switched over to showing the source code for the
FileWriter class, which was the class I was trying to look at when I started this process.
This is very cool. It's much more helpful to see the actual Java source when you click on a class that's in the JVM than it is to see the default binary-output information.
There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.