How to view the code of a third-party library in Eclipse

Source: Internet
Author: User

How to view the code of a third-party library in Eclipse

(Of course you need his code !) I believe that a friend who has used the android-support-v4.jar will know that after adding the lib library, we can not see his source code and documentation, this article to solve this problem:


Take the android-support-v4 as an example to explain:

1. We only need to create a properties file under the same directory, the name is the same as your support jar package, that is, the android-support-v4.jar will have a corresponding android-support-v4.jar.properties file.

2. Enter the source code path in the file (note the escape character)

OK. Restart eclipse and you will find that you can link to its source code.


How does Eclipse view the source code?

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... ", there will be a window (Edit JRE) 3. select 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" “src.zip "under your JDK directory 5. all the way to "OK", 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, that is, the class files of all classes you see in java doc are used: 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 or 1. Press Ctrl.
2. In the Java Editor, move the mouse over the type, method, or field name until the name changes to an underscore.
3. Click a hyperlink. If there are multiple definitions with the same name, a dialog box is displayed. You can select a definition you want to open. Open an editor that contains the selected elements.

How does eclipse view the source code?

The src.zip file in the javasjdk directory (for example, when you press Ctrl to view the source of a class or method, it will arrive at an interface and click the prompt to load it). The source code is in the file and does not need to be decompiled.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.