Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Java API Javadocs to show up in Eclipse in Ubuntu

I'm here again with a docs question. At my university, when using Eclipse, when placing the cursor over a Java API method name (for example: .size() ), I get very nice documentation about it.

Here at home I get

Note: This element neither has attached source nor attached Javadoc
and hence no information could be found.

Any quick and simple apt-get fix? Thanks in advance!!!!

like image 788
Manuel Araoz Avatar asked Nov 05 '09 04:11

Manuel Araoz


People also ask

How do I show 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.

Where is javadoc located Ubuntu?

The documentation you are looking for is in /usr/share/doc/libguava-java/api/ . Most (all?) packages install documentation into /usr/share/doc/packages-name . If you're ever unsure what was installed by a package, you can run dpkg -L package-name to get a list of files that were included.

How do I enable 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 find my javadoc?

Select 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.


1 Answers

Go to your JRE settings (Window > Preferences > Java > Installed JREs), select your current, then Edit it and set the Source Attachment for rt.jar.

You might have to install the sun-java6-source or openjdk-6-source packages depending on what you are using.

For the Sun JVM, sources will end up in /usr/lib/jvm/java-6-sun-1.6.0.15/src.zip.

PS: I'd suggest to use Sun JDK and to set it as default with sudo update-alternatives --config java but this is more a side note.

like image 108
Pascal Thivent Avatar answered Sep 20 '22 02:09

Pascal Thivent