Is it possible to browse the source of OpenJDK online?

后端 未结 8 1913
借酒劲吻你
借酒劲吻你 2020-12-04 07:50

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:

相关标签:
8条回答
  • 2020-12-04 08:18

    Append a "/file" to the root URLs to view the browser like this:

    • http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/
    • http://hg.openjdk.java.net/jdk7/jdk7/hotspot/file
    0 讨论(0)
  • 2020-12-04 08:20

    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.

    Steps:

    • [browse source]
    • Open url for jdk, e.g http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/
    • 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: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/archive/2ab13901d6f1.zip/src/share/classes/)
    • [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 openjdk_8u73_b2_src.zip classes/)
    • move the created zip file to proper location, it will stay there for a while, (e.g mv openjdk_8u73_b2_src.zip /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/src.zip, it must be from the additional openjdk source,
    • switch source back: could switch back to use "jdk_home/src.zip", if don't want to use the external openjdk source,
    • ok
    0 讨论(0)
提交回复
热议问题