score:26

Accepted answer

eclipse doesn't pull the tooltips from the javadoc location. it only uses the javadoc location to prepend to the link if you say open in browser, you need to download and attach the source for the jdk in order to get the tooltips. for all the jars under the jre you should have the following for the javadoc location: http://java.sun.com/javase/6/docs/api/. for resources.jar, rt.jar, jsse.jar, jce.jar and charsets.jar you should attach the source available here.

score:0

ensure "preferences" -> "java" -> "editor" -> "hovers" -> "combined hover" is checked.

score:0

i just had to dig through this issue myself and succeeded. contrary to what others have offered as solutions, the path to my happy ending was directly correlated to javadoc. no "src.zip" files necessary. my trials and tribulations in the process involved finding the correct javadoc to point at. pointing a java 1.7 project at java 8 javadoc does not work. (even if "jre8" appears to be the only installed jre available.) thus, i beat my head against the brick wall unnecessarily.

window > preferences > java > installed jres

if the jre of your project is not listed (as happened to me when i migrated a jre7 project to a new jre8 workspace), you will need to add it here. click "add..." and point your workspace at the desired jre folder. (mine was c://program files/java/jre7). then "edit..." the now-available jre, select the rt.jar, and click "javadoc location..." and aim it at the correct javadoc location. for my use:

for jre7 -- http://docs.oracle.com/javase/7/docs/api/ for jre8 -- http://docs.oracle.com/javase/8/docs/api/

voila, hover tooltip javadoc is re-enabled. i hope this helps anyone else trying to figure this problem out.

score:0

if you are using maven:

mvn eclipse:eclipse -ddownloadsources=true  -ddownloadjavadocs=true

score:1

likely a problem with the path that you specified in javadoc location. it is pretty finicky. make sure that it points at the root of where the javadoc starts. it could be a few directories down in the zip you've downloaded.

score:1

i have had a similar issue and looks like that the culprit was the space in the path to the archive (e.g., c:\program files\java\jdk). after moving the archive to another directory without spaces in path it started to work.

score:1

instead of attaching javadoc attach jdk src.zip

enter image description here

score:1

choose one class you want to view its documentation and press ctrl+click over it, the javadoc page will inform you that there is no javadoc file attached and bellow will see a button named "attach file". press that button and browse to the directory where jdk is installed, normally for win is c:\program files\java\jdk_xxx and inside this folder there is a src.zip file - sleect it and press ok and all is done - you already have javadoc attached.

score:1

for openjdk 8 on linux see: https://askubuntu.com/questions/755853/how-to-install-jdk-sources

the way that worked for me is:

  • the default src.zip is a symbolic link pointing to a non-existing folder ...
  • sudo apt-get install openjdk-8-source this adds this folder
  • locate "src.zip"
  • eclipse: window --> preferences --> java --> "installed jres", edit and point to src.zip (or open any jre class like for example hashmap and attach source)

you should now see the javadoc when opening jre classes via ctrl+shift+t, previously this was not possible, eclipse may have got a docs from the default url on mouse over methods but this requires a stable internet connection.

score:4

  1. go to your jdk installation. (c:\program files\java\jdk1.8.0_66 for me).

  2. unzip the src.zip file (becomes c:\program files\java\jdk1.8.0_66\src\ for me).

  3. in the eclipse editor window: ctrl + click on a java.lang library class. (something like string).

  4. eclipse will complain source not found and tell you that you don't have the source.

  5. click attach source -> external location -> external folder.

  6. find your source folder (c:\program files\java\jdk1.8.0_66\src\ for me).

  7. click ok -> ok.

  8. enjoy.

score:6

i went through the same problem and i did not find some of the above answer useful because they are old and with new jdk 1.8 , documentation section has been moved to src.zip in jdk folder (c:\program files\java\jdk1.8.0_101 ) .

now i tried everything from above and it was showing me the same problem if i press ctrl and click on (for example string or system) in my program i get the source not found.

now you can do this, go to the folder where jdk (c:\program files\java\jdk1.8.0_101) is installed and try to unzip src.zip. here you might face an issue as sometime due to administrative rights on this folder it would not allow you to unzip this src.zip. for solving the issue , copy src.zip and paste in any other folder ( example desktop) and then create a folder src and unzip in it. now copy this folder back to jdk 1.8 folder**(c:\program files\java\jdk1.8.0_101).**

now just go to eclipse and open any program and press ctrl and click on any external objects or anything (for example string or system) .you will get source not found , now click attach source -> external location -> external folder and add your src location (c:\program files\java\jdk1.8.0_101\src). now you are good to go , i tried and it worked for me.

all the above folder location are from my system , so it might be different for you.

score:12

old question, but i had current problems with this issue. so i provide you my solution. now the sources and javadocs are inside the jdk. so, unzip your jdk version.you can see that contanins a "src.zip" file. here are your needed sources and doc files. follow the path: window->preferences->java->installed jres-> select your jre/jrd and press "edit" select all .jar files, and press source attachement. select the "external file..." button, and point it to src.zip file.

maibe a restart to eclipse is needed. (normally not) now you should see the docs, and also the sources for the classes from jdk.

score:57

for offline javadoc from zip file rather than extracting it.

why this approach?

this is already answered which uses extracted zip data but it consumes more memory than simple zip file.

comparison of zip file and extracted data.

jdk-6u25-fcs-bin-b04-apidocs.zip  --->  ~57 mb
after extracting this zip file  --->  ~264 mb !

so this approach saves my approx. 200 mb.

how to use apidocs.zip?

1.open windows -> preferences

enter image description here

2.select jre from installed jres then click edit...

enter image description here

3.select all .jar files from jre system libraries then click javadoc location...

enter image description here

4.browse for apidocs.zip file for archive path and set path within archive as shown above. that's it.

5.put cursor on any class name or method name and hit shift + f2

score:107

to use offline java api documentation in eclipse, you need to download it first. the link for java docs are (last updated on 2013-10-21):

java 6
page: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-doc-download-355137.html
direct: http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-apidocs.zip

java 7
page: http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html

java 8
page: http://www.oracle.com/technetwork/java/javase/documentation/jdk8-doc-downloads-2133158.html

java 9
page:http://www.oracle.com/technetwork/java/javase/documentation/jdk9-doc-downloads-3850606.html

  1. extract the zip file in your local directory.
  2. from eclipse window --> preferences --> java --> "installed jres" select available jre (jre6: c:\program files (x86)\java\jre6 for instance) and click edit.
  3. select all the "jre system libraries" using control+a.
  4. click "javadoc location"
  5. change "javadoc location path:" from "http://download.oracle.com/javase/6/docs/api/" to "file:/e:/java/docs/api/".

it must work as it works for me. i don't need internet connection to view java api documentation in eclipse anymore.


Related Query

More Query from same tag