eclipse Ctrl +左键查看源代码Source not found

转载自:https://jingyan.baidu.com/article/11c17a2c6fa27af446e39dac.html

 

在使用Eclipse进行java编程时,有时我们需要查看一些类的源代码,这时ctrl+鼠标左键是个很常用的操作,但有时我们发现这个操作实现不了,经常显示Source not found。

工具/原料

  • Eclipse

方法/步骤

  1. 打开Eclipse,点击Windows。

    eclipse Ctrl +左键查看源代码Source not found

  2. 在Windows选项下,选择“perferences”。

    eclipse Ctrl +左键查看源代码Source not found

  3. 在“perferences”窗口下,选择java->Incelled jres。

    eclipse Ctrl +左键查看源代码Source not found

  4. 点击“jre8”,点击右侧“ Edit”。

    eclipse Ctrl +左键查看源代码Source not found

  5. 在edit jre对话框中,找到以“rt.jar”结尾的文件。点击展开。

    eclipse Ctrl +左键查看源代码Source not found

  6. 选择“ Source Attachment”。点击。

    eclipse Ctrl +左键查看源代码Source not found

  7. 在 “Source Attachment”对话框下,选择”External location“。路径为安装java JDK时的路径,关键是在此路径下,找到src.zip,就行了。

  8. 看一下结果,如”Math“,按下ctrl,点击鼠标左键,即可查看其源代码。

    eclipse Ctrl +左键查看源代码Source not found

    eclipse Ctrl +左键查看源代码Source not found