Eclipse如何跳转到Java系统类的源代码

In Eclipse you want to navigate to the source code of standard class String, and you get the following message: Source not found

Eclipse如何跳转到Java系统类的源代码

Solution

(1) Install JDK in your laptop, and then configure it into Windows->Preferences->Java->Installed JRE. Delete existing entry for JRE:

Eclipse如何跳转到Java系统类的源代码

And click Add… button:

Eclipse如何跳转到Java系统类的源代码

Add JDK instead:

Eclipse如何跳转到Java系统类的源代码

Once added, set JDK as default entry:

Eclipse如何跳转到Java系统类的源代码

(2) Preferences->Java Build Path, remove existing entry of JRE:

Eclipse如何跳转到Java系统类的源代码

Click Add Library button:

Eclipse如何跳转到Java系统类的源代码

Choose JDK instead:

Eclipse如何跳转到Java系统类的源代码

Once done, you can now navigate to the source code of standard class like String now.

Eclipse如何跳转到Java系统类的源代码

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
Eclipse如何跳转到Java系统类的源代码