Java downloads the source code under the sun package

Why do you want to re-download the sun package?

The classes under the sun package are all .class files. For example: sun.net.www.protocol.http.HttpURLConnectionthe source code of , turned out to be .class. The reason is that there is no corresponding source code file in the src.zip that comes with the JDK.

How to download the source code of sun package?

Find the official website of OpenJDK, the download page of jdk8: https://hg.openjdk.org/jdk8/jdk8/jdk/file/687fd7c7986d

Click to download the zip.

replace

Download, unzip.
Find src/share/classes, you can see the sun folder, copy.

Find the src.zip in the installed JDK, copy it to the desktop, and unzip it.
Paste the newly copied sun folder into the decompressed src directory. Then compress to generate a new src.zip.
Copy the src.zip of the new process to the JDK installation directory, replace the original src.zip, and it will be fine.

If you use Git, refer to: source code under java sun package

Guess you like

Origin blog.csdn.net/zhangjin1120/article/details/131137506