解决Eclipse中Source Not Found问题

时间:2024-03-30 19:34:14

解决Eclipse中Source Not Found问题

一、发现问题

在Eclipse中使用Ctrl+左键去看源码的时候会显示出了Source Not Found这个界面。
解决Eclipse中Source Not Found问题
通过从网上找了各种各样的方法都不可行,方法基本上都是去修改文件的Source Attachment。百度上那些方法都是因为没有绑定到对应的jar包,只要重新绑定就好。但是明明可以找到对应的jar包,而且通过解压那相应的jar包可以看到对应的代码。
但是其实如果你认真地去看看这个界面中,代码已经有显示出来了,只是不太正常而已
解决Eclipse中Source Not Found问题
这其实是Eclipse的反编译的问题,找到问题所在接下来就是解决问题的时候了。

二、解决问题

1).点击Eclipse工具栏中的Help中的Eclipse Marketplace
解决Eclipse中Source Not Found问题
2).输入Decompiler点击搜索,然后安装这个插件
解决Eclipse中Source Not Found问题
3).一步一步来安装好了就重启Eclipse
4).从工具栏中的首选项设置Eclipse默认的反编译工具(就你刚刚下载的那个)
点击Window,选择Preferences
解决Eclipse中Source Not Found问题
找到这个界面,这里选择JD-core
解决Eclipse中Source Not Found问题
记得要点击Apply,不然你做的操作不起作用
5).找到这个界面将*.class和*.class without source 的Associated editors
解决Eclipse中Source Not Found问题
将Class Decompiler Viewer 都改成Default
最后点击Apply and Close就可以解决问题了!!!!

三、展示结果

最后再打开刚刚显示的Source Not Found的源码。你会发现已经可以看了。
解决Eclipse中Source Not Found问题

这是我这个开发新手的第二篇博客,可能会有很多问题或者错误,请多多大家指点。