前言

  • Eclipse Version: 2019-12 (4.14.0)
  • win10
  • jdk 1.8

描述

eclipse按照后,发现rt.jar的类不能关联源码。

分析

不能关联源码的可能有:

  • 没有下载到源码src包
  • eclipse无法关联到src包

本次无法关联到rt.jar的源码,很显然是eclipse无法关联到src包(按照jdk后,rt.jar的源码是jdk里已经携带的)。

按照jdk时,还会按照一个独立的jre,一般jdk的安装目录如下:

eclipse默认会搜索到jre。jre中不包含源码(源码在jdk中)。因此,eclipse无法关联到源码。

解决办法

在eclipse重新配置jre,使之指向jdk中的jre。

配置过程,略。

延伸

maven项目能够管理源码,一般比较省心。
如果不是maven项目,或者maven项目因故没下载到源码,那么需要手动下载源码进行关联。

The jar file has no source attachment相关推荐

  1. the jar file has no source attachment解决方法

    今天开发一个简单的保存数据到数据库的功能,但是频繁报错,tomcat也一直崩溃,真的是...什么都不想说了.基础扎实才是王道!今天分享一个我遇到的问题并附上解决办法:the jar file has ...

  2. 【转】eclipse 查看原始类出现The jar file rt.jar has no source attachment解决方法

    因为rt的source在jdk目录的src.zip文件里,将文件设置为jdk下的src.zip就行了.具体如下 Window>Preferences>Java>Installed J ...

  3. The source attachment does not contain the source for the file  ActionSupport.class 错误

    The source attachment does not contain the source for the file  ActionSupport.class 错误 报错  Syntax er ...

  4. The source attachment does not contain the source for the file Activity.class

    最近利用Eclipse写android程序,在debug时,总是提示The source attachment does not contain the source for the file Act ...

  5. eclipse maven 项目发布到tomcat 报错 Failed to scan JAR [file:/C:/xxxxx.jar] from WEB-INF/lib

    报错信息如下: 警告: Failed to scan JAR [file:/D:/Development/Tomcat/apache-tomcat-7.0.35-64bit/webapps/Monda ...

  6. 代码在eclipse下不报错,在doc命令行下报错--jar file和runable jar file

    今天开发一个小工具,引用了Log4j,来记录日志,在eclipse下运行,代码正常,打包成jar放到doc命令行下运行报错: Exception in thread "main" ...

  7. Driver class 'org.gjt.mm.mysql.Driver' could not be found, make sure the 'MySQL' driver (jar file)

    org.pentaho.di.core.exception.KettleDatabaseException: Error occurred while trying to connect to the ...

  8. 【错误记录】Android Studio 配置 AspectJ 报错 ( Failed to create Jar file C:\xxx\aspectjtools-1.8.10.jar. )

    文章目录 一.报错信息 二.解决方案 三.Gradle 与 Gradle 插件版本适配 一.报错信息 在 Android Studio 中配置 AspectJ , 配置后的 Module 下的 bui ...

  9. 异常处理——Logging initialized using configuration in jar:file:/usr/local/apache-hive-2.3.4/lib/hive-comm

    启动hive一直: Logging initialized using configuration in jar:file:/usr/local/apache-hive-2.3.4/lib/hive- ...

最新文章

  1. UILabel设置行间距之后的自适应高度
  2. idea设置scanner = new Scanner(System.in);的实时模板
  3. 智能家居 (3) ——智能家居工厂模式介绍实现继电器控制灯
  4. Spring主要用到两种设计模式
  5. 蒙文字体怎么安装_蒙文搜索APP内置键盘布局图
  6. Mac 安装mysql8
  7. 小学计算机兴趣班培训总结,小学生电脑制作兴趣班三大主题学习内容
  8. Springboot统一异常处理并保存到数据库
  9. Centos7中MySQL的安装并设置开机启动
  10. 国美易卡利用大数据,国美易卡衍生三大类产品模型
  11. OA开发很简单,OA实施很复杂!
  12. 华为应用市场业务介绍
  13. 计算机学术论文shortessay,英语学术论文与研究方法-北京林业大学外语学院.doc
  14. 当商业空间撞见元宇宙艺术
  15. [APIO2015] T1巴厘岛的雕塑
  16. Asp.Net Ajax (1)---入门篇
  17. 【Pytorch】加载torchvision中预训练好的模型并修改默认下载路径(使用models.__dict__[model_name]()读取)
  18. 优酷海外用户自动显示简体页面方法
  19. 计算机网络-传输层(TCP流量控制)
  20. snmp4j使用v3连接报异常:Message processing model 3 returned error: Unknown security name

热门文章

  1. .NET Core 使用RabbitMQ
  2. H5网页App和纯原生的App差距在哪?
  3. 数据库事务隔离级别(转)
  4. Swift语言快速入门
  5. Single Area OSPF
  6. CISCO2621 基本配置步骤
  7. EasyNetQ介绍
  8. MyEclipse使用总结——使用MyEclipse打包带源码的jar包
  9. redis-查看日志
  10. JS之ES6扩展运算符三个点(...)用于剥离{} 获取属性值