Sunday, May 27, 2007

Using Javadoc With Eclipse

Normally, when we are coding java in Eclipse, we do not see any javadoc help when we hover over a keyword. This is because by default, eclipse is not configured to use javadoc. This is how you can enable javadoc in eclipse.

1. In the package explorer select the JRE System LIbrary -> rt.jar and go to it's properties.

2. In the Javadoc Location provide the javadoc URL. This may be eiher a URL like "http://java.sun.com/javase/6/docs/api/" or a local path like mine "file:/usr/lib/jvm/java-6-sun/docs/api/" (if you have javadoc installed locally, which is recommended)

3. Now when you mouse-hover on a java method or something, you shall see its associated javadoc. If its lengthy and you can't see all of it, press F2.

14 comments:

Anonymous said...

That works OK, but it is cumbersome that the javadoc location should be re-specified for each package in the JRE. Do you know a way to specify the javadoc location for the whole JRE at once?

Anonymous said...

i use jmf framework in eclipse but i cant able to see tips by press f2

Anonymous said...

can i see tips for external jars (mediaplayer.jar,xerces.jar and etc) in eclipse by press f2

Anonymous said...

thank you, this blogentry and comments helped me solve my problem with eclipse in ubuntu. I just did a apt-get install sun-java6-doc, downloaded the java doc to /tmp as the package specifies and there it was installed, just had to update eclipse's javadoc references in Window - Preferences - Java - Installed JRE's or something like that. Cheers=)

The Germanibian said...

thanks, this was helpful!

Anonymous said...

I'm not an expert, but I found that you can select Javadoc location in Project properties/Java build path/Libraries/ for external JAR for every project.

And how you can specify Javadoc for whole JRE.. simply select all JARs and press Javadoc location...

Abu Zaher Md Faridee said...

@Rasto: Thanks.

Kaustubh said...

Hey that was pretty helpful friend..

Unknown said...

Thanks buddy.

It worked for me too. But, is there some way to set a common location for the JRE?

Unknown said...

Thanks for your article..it help me to include javadoc in Eclipse Gynemede..

Codventure

Anonymous said...

Thank you very much.......It Worked!!

Vikas said...

Has anyone tried this on Galileo on ubuntu 9.04? I just don't see where to specify the javadoc.

Anonymous said...

Thank you.I work with ubuntu 10.04 and galileo and I see that the location is file:/usr/lib/jvm/java-6-openjdk/docs/api/ after installation of the openjdk6-doc package.Could you add it to your blog

~chAmi~ said...

Thanks you. You make me out to big problem.....

Back to Blogging

After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...