I. Associate JDK source code
Core Tip: Check the source code of the JDK class library in eclipse !!! Settings: 1. click window-preferences-Java-installed jres 2. at this time, the right side of installed jres is the List Pane, listing the system's JRE environment. Select Your JRE and click Edit ..., A window (edit JRE) 3 appears. select RT. JAR File
View the source code of the JDK class library in eclipse !!!
Settings:
1. Click "window"-> "Preferences"-> "Java"-> "installed jres"
2. in this case, the right side of "installed jres" is the List Pane, listing the system's JRE environment. Select Your JRE and click "Edit... ", a window appears (edit JRE)
3. Select the Rt. jar file: "C: \ Program Files \ Java \ jre_1.5.0_06 \ Lib \ RT. Jar"
Click "+" on the left to expand it,
4. after expansion, You can see "Source attachment :( none)", click this item, and click "Source attachment... ", select the “src.zip file under your JDK directory.
5. Click "OK" all the way to the end.
DT. jar is a class library about the runtime environment, mainly a swing package.
Tools. jar is a class library for some tools.
Rt. jar contains the JDK base class library, which is the class file of all classes you see in Java Doc.
2. Associate Android source code
Note that the android source code is not only associated with the kernel source code, but only the source code in the Android. jar package.
Kernel source: http://source.android.com/source/downloading.html
My development environment is 4.0, So download Android 4.0 source code http://download.csdn.net/detail/tianmi1988/5021734
Decompress the source code and put it in the sources directory where Android. jar is located. For example, I developed the SDK Based on android4.0.3,
The Directory of Android. jar is D:/program files/Android-SDK-Windows/platforms/Android-15,
Create a New Sources folder in this directory and put the source code in it. After eclipse is opened, ADT will be automatically associated with the source code.
Or manually add the ZIP or jar package. Right-click Android. jar to add the zip download path.
In addition, when we can use Android SDK manager to download the source code, it will automatically download the associated source code.
Usage:
You can select the type, method, or field name in the Java source code editor or code fragment editing test window, and then open the editor for element definition.
In the Java Editor, select the type, method, or field name. You can also click it only once in the name.
Perform one of the following operations:
1. Select Browse> open declaration from the menu bar
2. From the editor pop-up menu, select open declaration
3. Press F3