Accepted answer

the best way to answer your question is to summarize the answers from xavier, plastiv, vincefr and christopher.

step by step guide

in order to link the sources and javadoc to a .jar library that is automatically linked by eclipse you have to do the following:

  1. place the library .jar file in the libs folder, and the associated source .jar and doc .jar files in separate subfolders such as libs/src and libs/docs. you can use a name other than src and docs if you want, but it's important that the .jar files aren't directly in the libs folder.
  2. create a .properties file in the libs folder with the exact name of the actual library .jar (see example). make sure you keep the .jar part.
  3. specify the relative paths to the sources and javadoc .jar in the .properties file.
  4. close and re-open the eclipse project! optionally, refresh the project by pressing f5.
  5. select an object of the linked library in the source code.
  6. open the javadoc view in eclipse to check the documentation (see screenshot).
  7. open the source code declaration (default shortcut: f3) of the selected object.


the example uses the gson library.

directory structure of the libs folder:

├── docs
│   └── gson-2.2.2-javadoc.jar
├── gson-2.2.2.jar
└── src
    └── gson-2.2.2-sources.jar

contents of


additional information

you can of course move the javadoc and sources .jar into other folders and specify relative paths. that's up to you. placing the source and javadoc jars directly into the lib folder is possible but not recommended, as that causes documentation and source code to be included in your application.

screenshot of the eclipse javadoc panel:

javadoc view in eclipse

screenshot of an eclipse project using gson with android 4.2.2.:

eclipse test project screenshot

referencing unpacked javadocs

in case you want to reference javadocs which are not provided as a packed .jar but simply as files and folders as asked by android developer in the comments do the following:

  1. place the library .jar in the libs/ folder
  2. create a file (don't forget the .jar) with the following content:

  3. add the javadocs folders to the libs/ folder.

you should come up with the following folder structure:

├── docs
│   ├── allclasses-frame.html
│   ├── allclasses-noframe.html
│   ├── com
│   │   └── google
│   │       └── ads
│   │           ├── ad.html
│   │           │   ....
│   │           └── package-tree.html
│   │   ...
│   └── stylesheet.css
├── googleadmobadssdk-6.4.1.jar

do not forget to close and re-open the eclipse project as mentioned above! here is a screenshot of a working example project referencing the googleadmobads android library.

googleadmobads android library eclipse project


just update the adt plugin. that worked for me!!

  1. start eclipse, then select help > install new software.
  2. click add, in the top-right corner.
  3. in the add repository dialog that appears, enter "adt plugin" for the name and the following url for the location: note: the android developer tools update site requires a secure connection. make sure the update site url you enter starts with https.
  4. click ok. in the available software dialog, select the checkbox next to developer tools and click next.
  5. in the next window, you'll see a list of the tools to be downloaded. click next.
  6. read and accept the license agreements, then click finish.
  7. if you get a security warning saying that the authenticity or validity of the software can't be established, click ok.
  8. when the installation completes, restart eclipse

hope that helps!


for any given jar, if you would like to see the javadoc help on the tooltip while coding, do the following: right click your project > properties > java build path > libraries tab. click the arrow next to your jar to expand.

source attachment should point to the location of the actual jar (probably right in your java folder).

javadoc location: you have two choices here: url and archive. if your javadocs for this jar are in the form of a folder containing an index.html file at the first level, choose 'javadoc url' and point to that folder. if your javadocs are in a jar, choose 'javadoc in archive' and point to the jar. don't forget to restart your workspace/close and reopen your project to update the tooltip with the javadoc info.

i hope this helps give a simple answer for what i believe should be a very simple task.


my solution:

download an eclipse plugin called: "java source attacher feature".

later, select a jar and attach the source code using this plugin. click in the jar file to select it, right buttom on the mouse, and then select "attach java source".

when you have the source code you have automatically the javadoc.

now you can use f2 over the classes to view the asociated javadoc.



seems to be a moving target but, after having collected bits and pieces from many places (including answers to this very question that helped but failed to describe all necessary details, or maybe the system had changed slightly in the meantime), this seems to be the solution, at least as of now (august 28, 2013).

  • open up a folder for your javadocs somewhere not inside your project.
  • put your javadocs there unzipped, each into its own folder.
  • inside your lib folder, add an file for each lib you want to associate a javadoc with.
  • in that properties file, refer to the folder you unzipped the appropriate javadoc into (on windows, escape the backslashes):


  • close and reopen your project in eclipse (refreshing is not enough). you should now see the tooltips when you hover over the appropriate classes.

failing to observe any of these steps (not unzipping the javadoc, referencing a file instead of a folder, etc) seems to break it.


i know this question is rather old, but when i was facing the same problem yesterday and the solution posted above was way too annoying for me, i found out that one can easily add a source path definition to the .classpath file of the project. eclipse will then adapt it and you're able to browse through the source.

classpath entry before:

<classpathentry kind="lib" path="[path_to_my_jar]"/>

after adding the path to the source

<classpathentry kind="lib" path="[path_to_my_jar]" sourcepath="[path_to_my_source_jar]"/>

hope this helps


the library reference to commons-io-2.0.1.jar was broken when i upgraded to sdk tools and adt revision 17.

to resolve the problem i used project -> properties - > java build path and i selected the libraries tab. i deleted any reference to commons-io-2.0.1.jar and then used add jar to re-add commons-io-2.0.1.jar to the project. then i click the ‘>’ arrow next to the library name to expand the library reference and i used the edit buttons to set the source attachment and the javadoc location.

sorry i can't post an image as i don't have enough rep (please...).


on adt 22 i could not access javadoc for both commons-io-2.4.jar and android-support-v4.jar

this is the way i fixed it:

  1. precondition: both libraries are listed under "referenced libraries".

  2. right click on commons-io-2.4.jar and select properties. this window appears:

enter image description here

commons-io-2.4.jar is bundled with commons-io-2.4-javadoc.jar, so i specified the javadoc in archive external file path.

i did the same thing for the support library: right click on android-support-v4.jar and select properties. this screen appears:

enter image description here

this time i specied the path to the source directory.


for now, move the library you want javadoc to lib. them add that library to the build path and add the javadoc.

check this comment in the android issues.


i tried all of the above and none of them worked for me. i figured out a method that will always work. basically, the culprit is the way that the adt treats the "libs" folder so i quit using the "libs" folder. instead i created a "libraries" folder and used it.

you can do the following and it will always work - even if the adt should change how it changes how it deals with the "libs" folder in the future:

  1. create a "libraries" folder.
  2. create a sub-folder under it for each library.
  3. put all of the files for each library in the appropriate folder (java jar file, source jar file, javadoc jar file, etc).
  4. add the java jar file for each project in the "libraries" tab for the java build path by clicking on the add jars... button to add the jar from the library sub-folder in the "libraries" folder.
  5. attach the source/javadocs to each project by opening the project in the "libraries" tab, selecting the desired item, and clicking on the edit... button to add the source/javadocs from the library sub-folder in the "libraries" folder.
  6. check the checkbox for each project in the "order and export" tab for the java build path.
  7. after verifying that all libraries have been moved delete the "libs" folder.

by following the above procedure your project will have folders that look like this:

enter image description here

your java build path will look something like this:

enter image description here

in order and export the libraries are ticked:

enter image description here


an answer come from

in your libs folder, you must have:


and in your, just put doc=./doc/foo_doc

maybe you will have to refresh your project, to clean it, to close it and to reopen it.

it works for me!


on windows you have to escape the backslash for references to doc and src paths in the properties file. example, for android-support-v4.jar the properties file content is something like:

doc=c:\\program files (x86)\\android\\android-sdk\\extras\\android\\support\\v4\\docs
src=c:\\program files (x86)\\android\\android-sdk\\extras\\android\\support\\v4\\src

Related Query

More Query from same tag