26

Where can I find the source code of the Java API?

Matt Robertson
  • 2,551
  • 5
  • 27
  • 56

6 Answers6

19

Install the JDK. The sources for the public classes are packaged in src.zip.

Thorbjørn Ravn Andersen
  • 71,889
  • 31
  • 184
  • 335
17

OpenJDK code: Browse here
For example, if you looking for AWTUtilities.java, go here in the above link:

src› share› classes› com› sun› awt› AWTUtilities.java
  1. OpenJDK project homepage where they have all the instructions of downloading and building it
  2. OpenJDK Mercurial Repo hosted here
  3. JDK Documentation here
zengr
  • 37,540
  • 37
  • 125
  • 190
3

I'm not sure what you mean, but here is the API documentation

Source for OpenJDK implementation

n00begon
  • 3,483
  • 3
  • 27
  • 41
Marek Sapota
  • 19,424
  • 3
  • 32
  • 45
3

You can also find them online at http://www.docjar.org/.

João Silva
  • 85,475
  • 27
  • 147
  • 152
2

Presumably you mean the core libraries?

http://openjdk.java.net/groups/core-libs/

You might this alternative useful too:

http://www.gnu.org/software/classpath/

Steve-o
  • 12,503
  • 2
  • 39
  • 58
1

If you only need to look up some classes, the following page is also a good source:

http://grepcode.com

It works for different versions of various libraries.

Thomas
  • 749
  • 7
  • 14