| Author |
Sources of the java standard library?
|
Andreas Svenkson
Ranch Hand
Joined: Jan 17, 2011
Posts: 178
|
|
Hey guys.
I was wondering, I am sure I have sometimes (by accident) in netbeans opened the source-file of a class I was using in my program (say, for example, Integer), and I was wondering how to do this in Eclipse.
I was also wondering, are all source-files of the entire java SE api included in the jdk installation? Where in the installation can I find them?
Thanks,
Andreas.
|
 |
Ninad Kulkarni
Ranch Hand
Joined: Aug 31, 2007
Posts: 774
|
|
Try in following path after jdk installation
Java\jdk1.6.0_17\src
|
SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19214
|
|
It's actually a file called src.zip inside the JDK's root folder.
As for how to do this in Eclipse, you need to edit the JAR file, either from the installed JRE section or from the project's library list.
Installed JRE:
- Window -> Preferences
- Java -> Installed JREs
- select the JRE and click Edit
- select rt.jar and click Source Attachment
- select External File and browse for the src.zip file
Project library:
- right click the project and click Properties
- select Java Build Path
- select the Libraries tab
- expand your library (with the +), select Source Attachment and click Edit
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Andreas Svenkson
Ranch Hand
Joined: Jan 17, 2011
Posts: 178
|
|
Excellent, thanks Rob.
Out of curiousity, why is it specifically the rt.jar file that I should add the src.zip file to? What about all the other libraries listed under the jre?
// Andreas
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
|
rt.jar contains the runtime classes of the Java API; these are all the classes and interfaces listed in the API documentation. The other jars contain non-public implementation classes that you shouldn't be using directly in your program.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Sources of the java standard library?
|
|
|