26

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

Matt Robertson
  • 2,928
  • 5
  • 34
  • 62

6 Answers6

19

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

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
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
  • 38,346
  • 37
  • 130
  • 192
3

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

Source for OpenJDK implementation

n00begon
  • 3,503
  • 3
  • 29
  • 42
Marek Sapota
  • 20,103
  • 3
  • 34
  • 47
3

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

João Silva
  • 89,303
  • 29
  • 152
  • 158
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,678
  • 2
  • 41
  • 60
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
  • 759
  • 8
  • 15