Missing basic JavaDoc in Eclipse

Go To StackoverFlow.com


Up to a few days ago, Eclipse was working fine in locating the javadoc for base classes such as Java.io.File. Recently, though, hovering over these classes only yields a message indicating that the source and javadoc are missing:

"Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc."

I couldn't for the life of me locate the option that would let me reselect the location of the basic documentation. Does anyone know how to fix this?

2012-04-04 04:08
by akrolsmir


Expand your JRE System library and find rt.jar (classes.jar for Mac OS X). Right click, and select 'Properties'.


You can then specify the Javadoc location (as well as the source location).


2012-04-04 04:14
by Greg Kopff
Best answer for the helpful graphics = - akrolsmir 2012-04-04 04:21
The helpful graphics confused me because it made me skim over the words and the fact that it is rt on windows. An edit to the image with the text "rt.jar on windows" would be nic - Old Badman Grey 2014-11-11 19:18
I don't have a classes.jar entry under my JRE System Library Entry. Java SE 1.7 Ubuntu 14.04 Eclipse 4.4.1 OpenJDK 7

Additionally, all my other JARs are already pointing to http://docs.oracle.com/javase/7/docs/api/ including rt.ja - anon58192932 2014-11-18 02:31


The best way to do it is Go to Project > Properties > Java Build Path > Libraries and expand JRE System Library [your jre version] then, rt.jar. Select Source attachment, click Edit…. Select the source code file (External File…) and press OK.

Other ways to attach java source code is mentioned in this link


2012-04-04 04:13
by AurA
All valid solutions, thanks - akrolsmir 2012-04-04 04:20
This solution works well for when you don't have an internet connection - Aaron 2014-06-11 19:02
My rt.jar is already pointing to http://docs.oracle.com/javase/7/docs/api/ but I don't have any standard JDK documentation loading in Eclipse - anon58192932 2014-11-18 02:31
I should select Javadoc Location at jrt-fs.jar, and set https://docs.oracle.com/javase/7/docs/api/. This finally works for "Eclipse Oxygen.2" and "JavaSE-9 (jre-9.0.4) - Brethlosze 2018-03-09 20:25


I encountered this problem now a couple of times too. It's especially annoying if you have a lot of projects in your workspace and you don't want to set the javadoc locations for each project.

Referencing the online documentation works well indeed, and there is a way to do that globally for all Java libraries:

  • Go to: Window -> Preferences
  • Expand: Java -> Installed JREs
  • Select your default Java installation
  • Press ''Edit''
  • Select all the JRE system libraries
  • Press ''Javadoc Location...''
  • In the Javadoc location path put in the path to the online documentation. For Java 8 for example this is http://docs.oracle.com/javase/8/docs/api/. (If you press ''Validate...'' it will tell you if it is a valid javadoc location.)
  • Press ''OK'', then ''Finish'', then ''OK''

And here you have some images:

Eclipse Settings: Installed JREs

Select all JRE system libraries

Edit javadoc location

And your basic Java javadoc is ready to go.

2014-04-23 09:41
by Terry
I used this method and hit validate which passed. I then restarted Eclipse and still don't have any JavaDoc showing up.

Additionally, I can successfully query http://docs.oracle.com/javase/7/docs/api/ from a browser. This is for Open JDK 7 on Ubuntu 14.04 - anon58192932 2014-11-18 02:41


Press ctrl+click (or command+click if you're on a Mac) on any method which doesn't have javadocs. For example, in this line:


... assuming that no javadocs are available for println, control-clicking on println will open a new tab with a button labeled "Attach Source...". And that's it!

2012-04-04 04:13
by Óscar López
Kudos for an extremely quick and easy solution - akrolsmir 2012-04-04 04:20
This method is asking to attach java doc source at the project level. but the JDK should have documentation at the global level for every single project. otherwise this will be a pain having to do it for every project - anon58192932 2014-11-18 02:36


I had the same problem.

I uninstalled eclipse, removed all eclipse specific data from my user's home- and application data directory, uninstalled all Java JREs and JDKs but nothing helped.

The solution on my system was to change the protocol in the JavaDoc URL from HTTP to HTTPS

e.g. for JRE 7 i changed the URL from http://docs.oracle.com/javase/7/docs/api/ to https://docs.oracle.com/javase/7/docs/api/

(use the steps mentioned by Terry and replace the 'http' with 'https')

2014-11-21 10:41
by Markus
Upvoted you, as Eclipse should default to the correct URL for standard libraries, and this is effectively a way to make it work if you are on a machine that blocks non HTTPS traffic. Though it might be best to move this to a comment on @Terry 's answer - Didier A. 2016-06-13 21:46
This worked for me except it was the other way around. Mine was set to HTTPS and kept saying that was invalid when I'd click "Validate" and then I changed it to HTTP and it worked - Tim 2017-02-13 17:08