Eclipse is associated with the jdk source file, eclipsejdk source file

Source: Internet
Author: User

Eclipse is associated with the jdk source file, eclipsejdk source file

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 rt. jar file (JDK Installation File directory \ lib \ rt. jar;), click "Source Attachment. (Source Code appended) "button, select the src.zip file under your JDK directory

The default installation path is src.zip under C: \ Program Files \ Java \ jdk1.6.0_02. This is all source files of rt. jar.

Bytes --------------------------------------------------------------------------------------

If the above method does not work. Then, after searching for a class and displaying the interface without associated source code, click "source attachment" to associate

Rt. jar.




How does eclipse relate to jdk source code?

If your breakpoint is a Java internal method (you stop at System in. out. println), and you have installed JDK (Java Development Kit), not just JRE (Java Runtime Environment), so the eclipse step into will jump into this method. If the source code of the JDK associated with your eclipse settings is incorrect, eclipse will open the. class file (otherwise, directly open the source code inside the JDK ).
Step over does not find such a problem.

Answer:
I use the English version. If you use the Chinese version, the following steps correspond to the Chinese menu.
Select menu items
Window-> Preferences
Open the form and select
Java-> Installed JREs
Select the Java Runtime Environment you are using on the right panel. See section 1st (Baidu only uploads one graph, so I have merged several images)
Click Edit, select the Java class library to be associated in the lower-left panel, and click "+" to expand. On the right panel, click Source Attachment... select a source. For details, see section 2nd and section 3rd.
After selecting the desired code (usually the src.zip In the JDK installation directory), you can track it in one step.

However, there will be no errors in JDK code implementation. If you do not want to learn JDK, you do not have to follow it in. Read the Java API documentation and believe that JDK can correctly implement its functions. If you accidentally enter the. class file, click "step return" to return your own code.
In addition, group purchases on Virtual Machine groups are extremely cheap.

How does eclipse relate to jdk source code?

In Eclipse, everyone is used to pressing the F3 key to conveniently view the class, method, and variable declaration and Definition source code. But sometimes, when you view the source code of classes, methods, and variables declared/defined in the JDK library, Eclipse opens the corresponding code for you. class file (bytecode), because Eclipse has not loaded/associated the corresponding JDK Library source file. At this time, you can click the "Attach source”" button that appears when Eclipse opens the. class file. Then, you can compress the source file of the JDK Library (usually a file named" src.zip "in the root directory of JDK installation) into Eclipse. However, when I entered the page, I couldn't find the "Attach Source" button on the interface. who set this button to give pointers?

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.