To read the open source framework code and read the class file, we generally have two methods
1. Using MAVEN for related operations
2. Download the source package of the jar package for import reading
Here I'm using the second kind of
The steps are as follows:
A: Here if we want to read struts source code, first to the official download, here is recommended to download all package, is a package containing docs,src,lib, of course, you can also only download lib and src package, lib package for our jar package, is the usual need to import projects, The SRC package is the source package for the jar package, which contains the. Java source files for all jar packages, and docs is our documentation containing struts ' instructions for use
Download struts All-inclusive first, then unzip to see the following file
Then we open eclipse, any new Web project
We'll copy all Lib under struts into Lib under Project Web-inf.
Finally open the project under the Web App Libraries, select the jar package you want to read the right mouse button->properties, select Java Source Attachment, click External Folder, Select the physical location where the jar source package is located, OK to complete
Now you can enjoy the fun of reading the framework code.
Source reading and Analysis: Using Eclipse to view source code such as SSH