查看Java类源码非常重要,有助于我们更深的理解它、更好的使用它。而在eclipse中查看一个类的源码是非常方便的,直接按住 ctrl + 鼠标点击的那个类或方法,那么这个类或方法的源码就会出现。不过在此之前,需要先在eclipse中导入源码 src.zip. 这个源码src.zip不需要下载,只要你安装了jdk,那么在jdk安装的目录下就会有src.zip,无需解压,下面看一下怎么把源码导入eclipse中。

  1. 进入eclipse界面,依次点击 Window – Preferences – Java – Installed JREs

    解决eclipse查看源代码出现The jar file rt.jar has no source attachment问题的方法

  2. 选中 D:\java\lib\rt.jar (你的jre的lib目录下的rt.jar文件),然后选择 Source Attachment

    解决eclipse查看源代码出现The jar file rt.jar has no source attachment问题的方法

  3. 选择 External location ,点击 External File 浏览安装jdk的目录,找到src.zip,一次点击ok,finish 即可。

    解决eclipse查看源代码出现The jar file rt.jar has no source attachment问题的方法

相关文章:

  • 2021-07-04
  • 2022-01-05
  • 2021-07-06
  • 2021-09-22
  • 2022-01-13
  • 2022-01-05
  • 2021-11-05
  • 2022-12-23
猜你喜欢
  • 2021-12-12
  • 2022-12-23
  • 2021-11-29
  • 2021-07-30
  • 2021-04-06
  • 2021-10-17
  • 2021-06-02
相关资源
相似解决方案