View source code in Eclipse

In eclipse, you can Ctrl+左键单击view the source code:
insert image description here
but when you first start using it, the following situation will occur:
insert image description here
find the installation location of jdk, you can see a src.zip file, this is the source code of jdk, we first copy the path:
insert image description here
click Attach Source… button to configure:
insert image description here

You can also click: window-”preferences-”java-”Installed JREs
insert image description here
to find the path at the end of rt.jar, and then click Source Attachment…insert image description here

Click to select External location, and paste the previously copied path directly:
insert image description here
You can also click External File…, find src.zip for configuration:
insert image description here
Use Ctrl+left-click to view the source code:
insert image description here


When we look at the source code of the servlet, we find that we can't view it:insert image description here

Download the Tomcat source code: https://tomcat.apache.org/
insert image description here
Click Attach Source again, select the compressed package we just downloaded:
insert image description here
Then you can view the source code of the Servlet:
insert image description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324179185&siteId=291194637