Source code for the Java library classes

后端 未结 8 1073
旧时难觅i
旧时难觅i 2020-12-13 13:31

Where can I find the source code for the Java library classes? I mean classes in rt.jar.

Platform: Windows.

相关标签:
8条回答
  • 2020-12-13 14:12

    You can directly browse the code online here for Java : https://zgrepcode.com/java/openjdk/10.0.2/

    It is a great tool also for browsing most of the open source projects as it gives you internal linking to classes.

    0 讨论(0)
  • 2020-12-13 14:13

    Download the JDK. The sources for the public classes are in src.zip.

    0 讨论(0)
  • 2020-12-13 14:14

    As mention above, most of the source files can be found by downloading the SDK. However for some classes you can find the source code (javax.ssl etc') for I suggest adding the jad eclipse plugin that will decompile any class without using external site such as Docjar. Jad eclipse info: http://jadclipse.sourceforge.net/wiki/index.php/Main_Page

    0 讨论(0)
  • 2020-12-13 14:15

    As almost all the suggestions seem to be either grepcode or zgrepcode which are both down, I found one from OpenJDK here: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/

    Edit: a more complete version of all OpenJDK projects and JDK 6-15 can be found here: https://hg.openjdk.java.net/

    0 讨论(0)
  • 2020-12-13 14:17

    There is also grepcode.com (not sure how old this site is, perhaps this answer is an update for new solutions now), sample query:

    http://grepcode.com/search?query=java.lang.Math.sin&start=0&entity=type&n=

    0 讨论(0)
  • 2020-12-13 14:20

    If you only need to have a look at the source/implemenation, i would suggest using

    Docjar

    Edit

    GrepCode is even better

    GrepCode

    0 讨论(0)
提交回复
热议问题