简体   繁体   English

Javadoc 从未在 Eclipse 中显示

[英]Javadoc never showing in eclipse

Whenever I try to access the Javadoc for any class in Eclipse by hovering over a reference to it, it either says An exception occurred while getting the Javadoc or This element has no attached source and the Javadoc could not be found in the attached Javadoc .每当我尝试通过将鼠标悬停在对它的引用上来访问 Eclipse 中任何类的 Javadoc 时,它要么说An exception occurred while getting the Javadoc ,要么显示This element has no attached source and the Javadoc could not be found in the attached Javadoc I've read through several solutions on StackOverflow and have tried them all including:我已经阅读了 StackOverflow 上的几个解决方案,并尝试了所有解决方案,包括:

  • Installing JDK and adding it as a library in my project.安装 JDK 并将其添加为我的项目中的库。
  • Verifying the source of Javadoc in rt.jar is the correct URL.验证 rt.jar 中 Javadoc 的来源是正确的 URL。 When I click Validate on it it even says the location is likely valid.当我点击Validate时,它甚至说该位置可能有效。

The weird thing is, if I click on View Javadoc in Browser it opens directly to the correct Javadoc.奇怪的是,如果我单击View Javadoc in Browser它会直接打开正确的 Javadoc。

来自我在 Eclipse 中的最新会话的日志文件项目中的两个库位置可能有效。

As you can see in the exception message, Eclipse is currently using the JRE instead of the JDK , since it is set up as the primary one (according to the second screenshot).正如您在异常消息中看到的,Eclipse 当前使用的是JRE而不是JDK ,因为它被设置为主要的(根据第二个屏幕截图)。 Remove the JRE library from the project, you don't need it anymore.从项目中删除JRE library ,您不再需要它了。 The JDK contains everything you need, including the JavaDoc. JDK包含您需要的一切,包括 JavaDoc。

Windows->Preferences -> Installed JRE -> click on the JDK ->JRE Deifination will open -> In RT.JAR attach java source as shown below: Windows->Preferences -> Installed JRE -> 点击JDK -> JRE Deifination will open -> In RT.JAR attach java source如下图:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM