views:

2311

answers:

2

I'm having a pretty hard time with this!

I have installed the java documentation at:

file:///usr/share/doc/openjdk-6-jre/api/index.html

And loading that file up does show me all the documentation.

However, I would like to browse it directly from within eclipse and see the documentation when I hover over a class. For example, when I hover over "javax.servlet.http.HttpServletRequest", I would like to see the documentation for it. All I get is:

Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc.

Can anyone help correct my dev environment?

+1  A: 

javax.servlet.http.HttpServletRequest is not part of the OpenJDK, and so the OpenJDK documentation would not contain information on it.

You need to install the Servlet API documentation instead, then, in the library section of your Package Explorer tab, right-click servlet-api.jar, and select Properties. You will then be able to select a javadoc location for that.

Alternatively, for an Ubuntu-friendly solution, install the libservlet2.5-java-doc package, then add the javadoc to your Servlet API jar file using the procedure above.

Chris Jester-Young
Thanks for the answer, I will give this a go later when I am on that machine. I prefer to let ubuntu manage as much as possible so that part of the answer is ideal!
Neil Trodden
I still got an error initially but forgot to add file: before the uri. Incidentally, javax.servlet.http.HttpServletRequest was not being used from OpenJDK, it was (in google app engine) in a package called geronimo which google use for their servlets. Apparently, "Geronimo is a Java EE 1.4 certified app server" which means that I can use the docs you mentioned anyway as it offers the same API.
Neil Trodden
A: 

The following procedure will enable Java documentation to be available in Eclipse when you hover over some Java class. Download the Java Documentation (this is for version 6) from http://www.google.co.in/url?sa=t&source=web&ct=res&cd=4&ved=0CC0QFjAD&url=https%3A%2F%2Fcds.sun.com%2Fis-bin%2FINTERSHOP.enfinity%2FWFS%2FCDS-CDS_Developer-Site%2Fen_US%2F-%2FUSD%2FViewProductDetail-Start%3FProductRef%3Djdk-6u10-docs-oth-JPR%40CDS-CDS_Developer&ei=T-z3S87CAYuyNq3UweAF&usg=AFQjCNH54wkg50p7PJGmv6dEJd0zxXTGRA&sig2=Pv8-OZ7ZQEAsh89kUFhvUw This is a zipped file jdk-*-docs.zip ( * indicates the version number, for e.g., 6u18 which implies Java Version 6.18). Open Eclipse. Click on Window > Show View > Javadoc Right click on the Javadoc console. Select Open Input. Click "Change Attached Source". Select "External File". Navigate to the directory in which jdk-*-docs.zip exists. Open it. And there you have it - the entire documentation available to you at your fingertip(mousetip?).

Wasim Hossain