Is it possible to browse the source of OpenJDK online?

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.)

OpenJDK is now on GitHub:

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/

You should end up at

The latest JDK 8 OpenJDK Java Class Library source code can be found here:

Here is the basic step to get latest or any released version of Openjdk 8 (or any existing java version) source code, and use them in Eclipse.


  • [browse source]
  • Open url for jdk, e.g
  • click tags
  • choose proper tag, e.g jdk8u73-b02
  • then click browse,
  • then browse into folder src/share/classes,
  • [download source]
  • then click one of bz2 / zip / gz, to download source in relevant compressed format, (e.g for jdk8u73-b02 in zip format, the url will be:
  • [use in eclipse]
  • uncompress it,
  • zip the folder “classes/”, make “classes/” as the root dir of .zip file, (e.g first cd jdk-2ab13901d6f1/src/share/, then zip -r classes/)
  • move the created zip file to proper location, it will stay there for a while, (e.g mv /media/Eric/software/java/jdk/openjdk/openjdk8u73-b02/source/)
  • in eclipse, specify source file for jars of installed jre, could specify the source attachment for each jar of installed jre respectively, the most common jar is probably rt.jar,
  • optionally, might need refresh project to make it totally take effect, not sure is that necessary,
  • test it: in eclipse, ctrl + shift + t, then input Cancellable, select the sun.nio.fs.Cancellable of corresponding installed jre,
    if the source code is available, then it’s good, because this source is not available in jdk_home/, it must be from the additional openjdk source,
  • switch source back: could switch back to use “jdk_home/”, if don’t want to use the external openjdk source,
  • ok

Here’s a way to browse the repositories and look at just the bits you want.
Is that what you are asking?

Append a “/file” to the root URLs to view the browser like this: is great for similar things – not only OpenJDK sources, with searching in classes/methods and links between classes directly in highlighted code:

As mentioned in the other answers, the source code repository is at

However, the OpenJDK team mirrors some of the projects on GitHub:

Including the latest Java version project (

Surely is one good option. The other equally good source is zGrepCode . It has both Open JDK and Oracle java versions.

Leave a Comment