[java] How do I add the Java API documentation to Eclipse?

I have downloaded Java API documentation from http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs and have supposedly attached it to Eclipse using the

Window->Preferences->Java->Installed JREs->Edit->"Select rt.jar"->Javadoc Location

And the location has been accepted and "Validates" just fine. However, for the life of me, I can't get Eclipse to show the Javadocs in the tooltip whene I hover over an item (for example in the declaration of an ArrayList). I have also restarted Eclipse in attempts to get it to work

What am I doing wrong?

This question is related to java eclipse javadoc

The answer is


Instead of attaching JavaDoc attach JDK src.zip

enter image description here


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.


Ensure "Preferences" -> "Java" -> "Editor" -> "Hovers" -> "Combined Hover" is checked.


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.


  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.


if you are using maven:

mvn eclipse:eclipse -DdownloadSources=true  -DdownloadJavadocs=true

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.


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.


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.


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.


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


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.


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.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to javadoc

/** and /* in Java Comments Autocompletion of @author in Intellij Javadoc link to method in other class How to generate javadoc comments in Android Studio What is the IntelliJ shortcut key to create a javadoc comment? Maven is not working in Java 8 when Javadoc tags are incomplete How to see JavaDoc in IntelliJ IDEA? How to attach source or JavaDoc in eclipse for any jar file e.g. JavaFX? Adding author name in Eclipse automatically to existing files How to download Javadoc to read offline?