Where can I find the source code of the Java API?
Asked
Active
Viewed 1.9k times
26
-
Have you checked Google? – cdhowie Jan 08 '11 at 18:18
-
http://stackoverflow.com/questions/4256988/the-very-basics-for-using-guava – May 27 '14 at 19:48
6 Answers
19
Install the JDK. The sources for the public classes are packaged in src.zip.

Thorbjørn Ravn Andersen
- 73,784
- 33
- 194
- 347
-
I already found the code on Google Code Search, but out of curiosity is this only true for OpenJDK? I'm running Ubuntu and can't find it in the sun-java6-jdk directory. – Matt Robertson Jan 08 '11 at 22:42
-
Ubuntu repackages everything. Have you installed sun-java6-source? – Thorbjørn Ravn Andersen Jan 08 '11 at 22:57
-
It is true with the JDK 7 directly from Oracle as well. +1 for being by far the most correct answer here, and saving me decaminutes of time. – le3th4x0rbot Mar 27 '13 at 20:45
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
- OpenJDK project homepage where they have all the instructions of downloading and building it
- OpenJDK Mercurial Repo hosted here
- 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
2
Presumably you mean the core libraries?
http://openjdk.java.net/groups/core-libs/
You might this alternative useful too:

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:
It works for different versions of various libraries.

Thomas
- 759
- 8
- 15