Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you read JavaDoc? [closed]

What tools/websites do you use to read JavaDocs?

I currently use Firefox with 20+ tabs open when working on a J2EE project to have all the documentation available which is not very usable, is eating too much memory and is not searchable.

What I would expect from such a tool/website:

  • Aggregate JavaDocs from different locations
  • Direct access to types like Ctrl+T in Eclipse or similar
  • Fulltext search
  • Cross referencing between all the Java libraries I've chosen
  • For a tool: offline support
  • Speed

not mandatory:

  • possibility to annotate things
  • support for different versions of a library (+ diffing ?)
  • IDE integration

Edit:

Thanks for your answers. I knew most of the sites but gave them another try. Here is my judgement:

  • built-in Eclipse/IDE features
    • tightly integrated
    • offline/online support
  • javadoconline.com (no longer maintained)
    • works
    • clean looks
    • finds matches in more than one version of the api and allows easy switching
    • simple but working
    • fast
  • jdocs (offline)
    • seems very sophisticated
    • sometimes slow
    • some recent versions of libraries seem to be missing (Seam 2.0.0, Hibernate Validators) but it looks like you can add them yourself
    • IDE integration (not tested)
    • wiki style comments to each item
  • docjar.com
    • works
    • fast
    • cluttered UI
  • javadoc_isearch
    • greasemonkey script for firefox which makes navigating javadocs easier
    • works smooth and perfectly
like image 659
jrudolph Avatar asked Sep 16 '08 15:09

jrudolph


People also ask

How do I read a javadoc?

Accessing the Javadoc from NetbeansSelect the desired package, class or method name, right-click and select Show Javadoc. This will launch your default web browser and navigate to the Javadoc for the selected item.

Does javadoc show private methods?

Nope, you shouldn't write javadoc for private methods. End users don't have access to private fields or methods so there really isn't a point in providing javadoc for them. Private fields and methods are only meant for the developer. If you really need to though, feel free to write comments for non-obvious logic.

How do I find my generated javadoc?

From the main menu, select Tools | Generate JavaDoc. In the dialog that opens, select a scope — a set of files or directories for which you want to generate the reference, and set the output directory where the generated documentation will be placed.

How do I read javadoc in Eclipse?

To see the javadoc of a class having attached source in eclipse: select Window -> show view -> javadoc (or alt + shift + q, j). then in the javadoc view, right click -> open attached javadoc (or shift + F2), this will display the javadoc of the class in the internal browser of eclipse.


2 Answers

If you use Eclipse, it offers support for Javadocs. For example, hovering your mouse over a method call will display a tooltip showing you the Javadoc for that method. Documentation for the core Java classes are supported out of the box. However, if your project uses any additional libraries (JAR files), some configuration is required in order to plug their Javadocs into Eclipse.

  1. Go to the "Java Build Path" section of your project properties.
  2. Go to the "Libraries" tab and click the "plus" icon next to the JAR file.
  3. Click "Javadoc location", then the "Edit..." button.

This will let you specify where the Javadocs for that JAR are located. It will even let you specify a website URL, so you don't have to download the Javadocs yourself!

like image 61
Michael Avatar answered Oct 06 '22 19:10

Michael


JavaDoc jar can be unzipped directly. In theory any released javadocs can be downloaded and viewed offline.

  1. download directly from maven repository. For example: http://central.maven.org/maven2/com/googlecode/objectify/objectify/5.0.3/objectify-5.0.3-javadoc.jar

  2. Now you get objectify-5.0.3-javadoc.jar, rename the file to objectify-5.0.3-javadoc.zip

  3. use your favourite unzip tool to extract it, now you have a folder objectify-5.0.3-javadoc

  4. double click index.html will open the index page on your default browser.

like image 29
Max Avatar answered Oct 06 '22 18:10

Max