Where can I find the source code for the Java library classes? I mean classes in rt.jar
.
Platform: Windows.
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.
Download the JDK. The sources for the public classes are in src.zip.
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
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/
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=
If you only need to have a look at the source/implemenation, i would suggest using
Docjar
Edit
GrepCode is even better
GrepCode