Manuel Araoz
Manuel Araoz

Reputation: 16406

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!!!!

Upvotes: 10

Views: 12755

Answers (5)

Vijay Tyagi
Vijay Tyagi

Reputation: 11

  1. Download Java sourece. i get it from http://download.java.net/openjdk/jdk8/

2.Go to Window > Preferences > Java > Installed JREs

Select the installed JDK and double click on it, a edit JRE window will get open.

  1. select rt.jar click add source and and select the patch where you have downloaded java source in step 1.

  2. then exit by clicking OK/ Finish

Upvotes: 0

Wasim Hossain
Wasim Hossain

Reputation: 11

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?).

Upvotes: 1

Pascal Thivent
Pascal Thivent

Reputation: 570375

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.

Upvotes: 22

matt b
matt b

Reputation: 139931

In Preferences, make sure that under Installed JREs you are using a JDK and not a JRE.

I don't think that the JRE installs include the source attachment.

Upvotes: 3

Adrian Park
Adrian Park

Reputation: 109

Try out apt-get install eclipse-source.

Upvotes: 1

Related Questions