Search code examples
javaeclipsejavadoc

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. I've read through several solutions on StackOverflow and have tried them all including:

  • Installing JDK and adding it as a library in my project.
  • Verifying the source of Javadoc in rt.jar is the correct URL. When I click Validate on it it even says the location is likely valid.

The weird thing is, if I click on View Javadoc in Browser it opens directly to the correct Javadoc.

Log File from my latest session in Eclipse Both Libraries in Project Location is Likely Valid.


Solution

  • 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). Remove the JRE library from the project, you don't need it anymore. The JDK contains everything you need, including the JavaDoc.