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

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

解决方法:

  1. 打开Eclipse,点击Windows。
    第一步
  2. 在Windows选项下,选择“perferences”。
    第二步
  3. 在“perferences”窗口下,选择java->Incelled jres。
    第三步
  4. 点击“jre8”,点击右侧“ Edit”。
    第四步
  5. 在edit jre对话框中,找到以“rt.jar”结尾的文件。点击展开。
    第五步
  6. 选择“ Source Attachment”。点击。
    第六步
  7. 在 “Source Attachment”对话框下,选择”External location“。路径为安装java JDK时的路径,关键是在此路径下,找到src.zip,就行了。
  8. 看一下结果,如”Math“,按下ctrl,点击鼠标左键,即可查看其源代码。

猜你喜欢

转载自blog.csdn.net/weihua_li/article/details/55257209