First create a new project in Eclipse, add the jar files needed to run Struts2, and add them to the project's Classpath (in Lisbs, right-click the build path such as:
), after the successful interface 1-17 is shown. ( Remember to right-click the jar package in referenced libraries )
|
Figure 1-17 New project in Eclipse |
Next, let's attach the corresponding source code for these jar files added to the classpath. Take "Struts2-core-2.2.1.jar" as an example, right-click on "Struts2-core-2.2.1.jar", select the properties (Alt + Enter) tab, pop up the jar file's property options box, shown in 1-18.
|
(Click to view larger image) Figure 1-18 Attach the source bundle for the jar file |
Select the "Java Source Attachment" option on the left side of the tab, click the button on the right side of the input box, specify the directory where the source code is located or the jar file (zip file) where it is located, click the OK button and the library file is appended with the corresponding source code (at this point, We will find the form of the jar file forms of source code in the management of the convenience, we can even put the source file into a workspace repository directory is referenced by all library files.
After the library file is attached to the source code, expand the library file, and double-click on the class file, you can see the class file corresponding to the source, 1-19 is shown.
|
(Click to view larger image) Figure 1-19 Viewing the source code in eclipse |
After the library file is appended with its corresponding source code, we can use the Eclipse IDE features and shortcut keys to view and analyze the source code.
Debug jar package source code in Eclipse (debug Struts2 source)