Using Javadoc with Eclipse in Ubuntu

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/ /tmp/
You need to rename the file to for the installer to work. Enter
sudo chown root:root /tmp/
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- 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!

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s