When you’re using Eclipse to program in Java and you hover over a keyword (like a function name, a package, or a class), some Javadoc will be displayed, showing what the keyword does and how it is used. The default installation of Eclipse did not include Javadoc, so hovering over keywords only gave me a message that Javadoc wasn’t installed. Here’s how to get Javadoc installed and working.
First, enter
sudo apt-get install sun-java6-doc
The installer will prompt you to download a zip file containing the documentation from Sun. Bring up Firefox and head to Sun’s website. Click the Download link next to Java SE 6 Documentation, agree to the terms and click Continue. Click the zip file to download the documentation.
When the download finishes, in another terminal, enter
sudo mv /path/to/zip/file/documentation.zip /tmp/jdk-6-doc.zip
You need to rename the file to jdk-6-doc.zip for the installer to work. Enter
sudo chown root:root /tmp/jdk-6-doc.zip
to change the file permissions.
Back in the first terminal, hit enter, and the installer should continue. When it finishes, in Eclipse, click Window – Preferences – Java – Installed JREs, and click the JRE (mine was called java-sun-1.6.0.07). Click Edit, and use Shift+Click to select all the JRE system libraries. Click Javadoc Location, and enter file:/usr/lib/jvm/java-6-sun/docs/api/ in the box. Click Validate to test it (you can open it in your browser to double check), and click OK out of all the dialogs. Javadoc should now be working!