• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sources of the java standard library?

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 814
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try in following path after jdk installation

Java\jdk1.6.0_17\src
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Andreas Svenkson
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic