0

Would you know whether it's possible to store javadocs linked to jars so that they are available when not connected to the internet?

It seems that sometimes I can download javadocs for offline access, but not always.

For example, I would like to have this for offline access. How should I go about it ?

Martin
  • 23,844
  • 55
  • 201
  • 327

2 Answers2

3

Try attaching the src jar to the library.

Take a look at this :

How to attach javadoc or sources to jars in libs folder?

In your case you would download and use the following jar. http://pivotal.github.com/robolectric/downloads/robolectric-0.9.4-src.jar

Once you have attached the src jar you also have access to the Javadoc in the javadocs view.

Is there a Javadoc repository ?

To answer another part of your question, I do not know of an offline repository, but there is an online one worth exploring : http://www.docjar.org/

There is also an Eclipse plugin for docjar which can be installed using from here.

Having said that, I don't think they would go to the trouble of generating javadoc for third part libraries like roboelectric which provide one themselves. In that case, you are stuck generating the Javadocs manually using the steps in the following section.

Generating Javadoc from src.jar

tl;dr : Using the steps below, I generated the Javadoc from the robolectric-0.9.4-src.jar source jar. The javadoc thus generated can be downloaded from here.

Step 1: Extract the robolectric-0.9.4-src.jar (using 7-zip or another archive utility). Move the android , com and META-INF folder inside a folder called src (This is useful in the next step). Let's say you extracted the robolectric-0.9.4-src.jar inside c:\robo. It would now have the following folders : c:\robo\src\android c:\robo\src\com c:\robo\src\META-INF

Step 2: Create an Eclipse project using the extracted source. This can be done by creating a new Java project inside Eclipse and instead of using the default workspace location, point to the location of the directory above (c:\robo).

enter image description here

Step 3: Now run the javadoc wizard by going to File -> Export -> Javadoc like so :

enter image description here

Step 4: Select 'Private' package to get Javadoc for all classes. enter image description here

Step 5: Next, select all jars except tools.jar in referenced jars : enter image description here

Step 6: Then, choose the path of the overview html and Check Open Generated File in browser: enter image description here

Step 7: Click on Finish. On doing so, you'll see the Javadoc task running in the Debug view :

enter image description here

And when it finishes a browser view should open with your Javadoc ! enter image description here

Step 8: Profit ! Your Javadoc should now be generated and accessible.

Community
  • 1
  • 1
Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
  • Great, thanks, but this is for the source to give me context sensitive help in eclipse correct? This is something that will be very helpful too but is it not possible to view it using HTML like on the link I showed ? The eclipse "javadocs view" only show context sensitive help, right? You cant search for a class etc? – Martin Aug 20 '12 at 09:17
  • @Martin, though I have not tried it you should be able to generate the 'html' javadoc from the source jar. Let me update my answer with how to do that. – Ashutosh Jindal Aug 20 '12 at 09:20
  • @Martin, I have updated my answer with the generic steps to generate the Javadoc given a source jar. I have also generated the javadocs for `roboelectric-0.9.4` (The link to the archived javadoc is in my answer). – Ashutosh Jindal Aug 20 '12 at 10:02
1

I understand that you want to see the source code and Javadocs for the third-party libraries your project depends on during debugging, for instance.

You can do this: open a class that is in such a library in an editor. You will see an "Attach Source..." button. Click on it and navigate to the source archive for the project. Once located and attached, you will be able to see the entire source code and also Javadocs when needed.

Dan D.
  • 32,246
  • 5
  • 63
  • 79