Is it possible to browse the source of OpenJDK online?

Hosam Aly picture Hosam Aly · Jan 4, 2009 · Viewed 26.8k times · Source

Is it possible to browse the source code of OpenJDK online, just like I can do with SourceForge's projects? I never used Mercury before, so I felt confused.

(Note: I don't want to download the source. I just want to browse it online, to see how some methods are implemented.)

Answer

Rasmus Faber picture Rasmus Faber · Jan 4, 2009

OpenJDK is now on GitHub: https://git.openjdk.java.net/jdk

It is a large project, but you will find the implementations of the core classes under jdk/src/java.base/share/classes.

For instance you can find the implementation of java.util.List here.


If you need to browse older versions, you still need to use the old Mercurial interface.

The Mercurial interface there is quite confusing if you are not used to it, and since this is a large project, it can be hard to find what you are looking for.

Here is an example:

To find the JDK6 implementation java.util.List, select "jdk6", "jdk", select browse. Then browse to src/share/classes/java/util/List.java.

You should end up at http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/tip/src/share/classes/java/util/List.java