views:

788

answers:

2

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

+2  A: 

Here's a way to browse the repositories and look at just the bits you want. http://hg.openjdk.java.net/ Is that what you are asking?

duncan
Not exactly. I went there before I asked but I couldn't find my way around the Mercurial interface. :(
Hosam Aly
Sorry, I actually went to http://openjdk.java.net/projects/nio and tried to find my way from there. I'll check this link again. Thanks.
Hosam Aly
+7  A: 

Use http://hg.openjdk.java.net/ as duncan suggested.

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/jdk6-gate/jdk", find the "default"-branch under "branches" and select "manifest". Then browse to src/share/classes/java/util/List.java.

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

Rasmus Faber
Thanks a lot. I went there trying to find the source for java.nio.file.FileRef, but I couldn't find it. Could you please help me? Thank you.
Hosam Aly
You can find that one here: http://hg.openjdk.java.net/nio/nio/jdk/file/d5e2831c01c4/src/share/classes/java/nio/file/FileRef.java (or perhaps see here: http://stackoverflow.com/questions/410705/best-way-to-determine-if-two-path-reference-to-same-file-in-c#410794 )
Rasmus Faber
For anyone trying this the default branch number changes. So the procedure described is correct, just don't be surprised if the link doesn't work.
Patrick