Java (6) ------ source code learning --- How to view the source code of the jar package in myeclipse
The idea of viewing the source code and code specifications are an important means for us to learn and improve the code writing capability.
Sometimes we want to see the implementation of classes and methods in a jar package, but cannot view them.
This is because the source code of the jar package is not loaded. You only need to find the source code of the jar package and set the path.
Source code download
You need to find the source code by version, which can be a zip package or a jar package.
Here are a few websites looking for the source code, you can also go to the jar package's official website to find.
Github
Https://github.com/openjdk-mirror/jdk7u-jdk
Sourceforge
Https://sourceforge.net/projects/jdk7src? Source = directory
Add source code
There are three ways to add source code:
Add
Add from project buildPath
Automatically add maven
If you have used maven to manage jar files, you can easily download the source code from the maven package. You only need to modify the configuration.
If you are not familiar with maven, see
Introduction to Maven
The source code for automatic download of maven settings is as follows:
Select windows-Preferences-Maven-Download Artifact Sources.
Ps: here we record how to view the source code of the packages included in the project. As for external projects, such as tomcat server, the source code is a complete project, find the source code and load it into a project.