Reputation: 73
sorry for bothering you all ..
I am trying to check out the SDK "Original" source code of sun java 1.7.0 (the src.zip file that come along with the complete package) in eclipse. I wanted to investigate the library src code for java.io.ObjectInputStream or java.util.ArrayList ....etc
But when I unzip the src.zip file and put it in Eclipse (under a new Java project) it shows me errors (attaching a snapshot of some errors ) ..Errors occurred during the compiling the source code lib
I am also attaching some of the errors screen shots ....... Errors in the code
Please pardon my ignorance and guide me to the correct path.
Many thanks
Regards
Upvotes: 0
Views: 340
Reputation: 12538
src.jar
does only contain the source code of the public APIs and in certain places those delegate to 'internal' classes, e.g. com.sun.*
.
If you want to look at the publicly available source code, you just have to install a JDK and point your Eclipse to the JDK instead of the JRE. Then it will automatically link to the source. Example screenshots reference IBM JDK (not JRE) 7 on Ubuntu.
EDIT: I forgot to mention that if you use OpenJDK via apt
on Ubuntu (your screenshots look like this), you must explicitly install the source:
sudo apt-get install openjdk-6-source
Workspace preferences:
and source code for java.util.ArrayList
The icon on the editor tab indicates that this is just a link to the source file and not the source itself, you cannot edit it.
Upvotes: 3