Varun Vats
Varun Vats

Reputation: 509

Browse JDK Source Code in Eclipse Like GrepCode

I like the way you can browse the source code of a library in GrepCode. Is there any way I can do the same in Eclipse?

I know that I can open the declaration of a class and look through it, but there seems to be no way I can search for something (a method, for example) in the Declaration window.

What I am really looking for is a way to browse the source code of the standard library just like I browse the source code of a class I am writing. It doesn't necessarily have to be the source that ships along with my JDK; I am happy to look at some other version as well.

What would be the best way to achieve this? Will I have to download OpenJDK and add it as a project in Eclipse?

Upvotes: 0

Views: 1634

Answers (4)

Dylan Smith
Dylan Smith

Reputation: 49

I think one of the good alternative for what you are looking for is zGrepCode. It allows you to browse Java Open Source projects as you are doing it in Eclipse by providing interlinking.

http://zgrepcode.com

Here is the place I found about this wonderful free tool.

https://dzone.com/articles/grepcode-is-down-whats-next?fromrel=true

Upvotes: 1

Chip McCormick
Chip McCormick

Reputation: 744

Pretty sure that m2eclipse allows source browsing, see: Get source jar files attached to Eclipse for Maven-managed dependencies

Intellij also has a maven plugin available that allows browsing.

Upvotes: 0

Varun Vats
Varun Vats

Reputation: 509

Actually I just went with the Search feature in Eclipse. Since I wanted to look at the source code for classes in the JRE libraries, I just do Search --> Java and select the appropriate options (see the attached screenshot).

enter image description here

I would think that this Search feature could also be used to search in the libraries included in your build path too.

Upvotes: 0

Rafael Oltra
Rafael Oltra

Reputation: 1239

You can install Java Decompiler plugin for Eclipse, such as JD-Eclipse

You could also use the src.zip file that ships alongside Oracle's JDK (located for example at something similar to C:\Program Files\Java\jdk{version} in Windows) and load it on Eclipse build path as a library (src.zip contains sources files for the java., javax. and some org.* packages, but not for com.sun.* packages)

Or you could download the whole bundle of source code for JDK at http://download.java.net/openjdk/jdk6/ (for JDK 1.6) and do the same

Upvotes: 1

Related Questions