how to display java API document in eclipse

W

wei

Hi,
I'm new to Eclipse. Is there a way to display java API specification
when the mouse is on a standard java class/function? For example, when
I hover on the word "System", it should display the spec of
java.lang.System like the following page or similar content?

http://java.sun.com/javase/6/docs/api/java/lang/System.html

I specified javadoc location (http://java.sun.com/j2se/1.5.0/docs/
api/) in project properties in eclipse, but when I hover on the word
System, a small yellow popup box displays:

"java.lang,System
Note: This element neither has attached source nor attached javadoc
and hence no information could be found"

Did I do anything wrong?

Any suggestion is appreciated,

Wei
 
T

Thomas Fritsch

wei said:
I'm new to Eclipse. Is there a way to display java API specification
when the mouse is on a standard java class/function? For example, when
I hover on the word "System", it should display the spec of
java.lang.System like the following page or similar content?

http://java.sun.com/javase/6/docs/api/java/lang/System.html

I specified javadoc location (http://java.sun.com/j2se/1.5.0/docs/
api/) in project properties in eclipse, but when I hover on the word
System, a small yellow popup box displays:

"java.lang,System
Note: This element neither has attached source nor attached javadoc
and hence no information could be found"

Did I do anything wrong?

Any suggestion is appreciated,
What you might have done, is to specify the Javadoc location of your
*own* classes written by yourself.

What you have to do, is to specify the Javadoc location of your JRE
system library (especially "rt.jar", because this jar file contains the
classes java.lang.*, etc).
You can do it from the tree view in your package explorer:
Right-click on "JRE System Library - rt.jar";
from the pop-up-menu select "Properties";
in the dialog go to "Javadoc location" and enter your location.
 
T

Thomas Fritsch

Thomas said:
What you might have done, is to specify the Javadoc location of your
*own* classes written by yourself.

What you have to do, is to specify the Javadoc location of your JRE
system library (especially "rt.jar", because this jar file contains the
classes java.lang.*, etc).
You can do it from the tree view in your package explorer:
Right-click on "JRE System Library - rt.jar";
from the pop-up-menu select "Properties";
in the dialog go to "Javadoc location" and enter your location.
and in the same dialog go to "Java source attachment" and enter your
local "src.zip" file. (on my system I have
"C:/Programme/Java/jdk1.6.0_01/src.zip")

Actually it is the "java source attachment" (not the "javadoc loaction")
from where eclipse gets the texts showing up in the yellow pop-ups.
 
W

wei

and in the same dialog go to "Java source attachment" and enter your
local "src.zip" file. (on my system I have
"C:/Programme/Java/jdk1.6.0_01/src.zip")

Actually it is the "java source attachment" (not the "javadoc loaction")
from where eclipse gets the texts showing up in the yellow pop-ups.


Thomas,
Thank you for the reply. But this is not what I want.
I am trying to display the following page in eclipse, for example,
http://java.sun.com/javase/6/docs/api/java/sql/Connection.html
(it'll be better if it is displayed in frame)
when I click (or by any other action) on the word "Connection" in my
code.

Thanks again,

Wei
 
I

Ian Wilson

There are two categories of Javadoc as far as Eclipse is concerned:
1) Javadoc you generate for the classes you write yourself.
2) Javadoc for the Sun class libraries

You have applied a solution intended for 1 to the docs for 2.

I am trying to display the following page in eclipse, for example,
http://java.sun.com/javase/6/docs/api/java/sql/Connection.html (it'll
be better if it is displayed in frame) when I click (or by any other
action) on the word "Connection" in my code.

Thomas already pointed out the correct approach. See this tutorial for a
more detailed explanation

<http://www.cs.laurentian.ca/badams/c1047/eclipse-tutorials/javadoc-tutorial.html#javadoc2>
 
W

wei

There are two categories of Javadoc as far as Eclipse is concerned:
1) Javadoc you generate for the classes you write yourself.
2) Javadoc for the Sun class libraries

You have applied a solution intended for 1 to the docs for 2.


Thomas already pointed out the correct approach. See this tutorial for a
more detailed explanation

<http://www.cs.laurentian.ca/badams/c1047/eclipse-tutorials/javadoc-tu...>

Hi Ian,

Thank you for the info. I got it working now. The only step I missed
before was to press shift-F2.

By the way, do you know how to get Firefox to work with Eclipse and
recognize the space in "file:/c:/Program Files/..."?

Firefox only reads "file:/c:/Program", and I tried to put quotes
around the location string in eclipse, it doesn't work.

Thanks again,

Wei
 
T

Thomas Fritsch

wei said:
By the way, do you know how to get Firefox to work with Eclipse and
recognize the space in "file:/c:/Program Files/..."?

Firefox only reads "file:/c:/Program", and I tried to put quotes
around the location string in eclipse, it doesn't work.
Try "file:/c:/Program%20Files/..."
 
I

Ian Wilson

Thomas said:
Try "file:/c:/Program%20Files/..."


Interestingly, it works for me without encoding the space

I have
WinXP Pro SP2
Firefox 2.0.0.4,
Eclipse 3.2.2 (the Web Services version),

In Eclipse my rt.jar "Javadoc location" has
(*) Javadoc URL
Javadoc location path:
file:/C:/Program Files/Java/jdk1.6.0_01/docs/api/

I think I used the "Browse" button rather than type it in by hand.

When I press shift-f2 Firefox shows the URL as (e.g.)
file:///C:/Program%20Files/Java/jdk1.6.0_01/docs/api/javax/xml/validation/Validator.html
 
W

wei

Interestingly, it works for me without encoding the space

I have
WinXP Pro SP2
Firefox 2.0.0.4,
Eclipse 3.2.2 (the Web Services version),

In Eclipse my rt.jar "Javadoc location" has
(*) Javadoc URL
Javadoc location path:
file:/C:/Program Files/Java/jdk1.6.0_01/docs/api/

I think I used the "Browse" button rather than type it in by hand.

When I press shift-f2 Firefox shows the URL as (e.g.)
file:///C:/Program%20Files/Java/jdk1.6.0_01/docs/api/javax/xml/validation/Validator.html

Ian,

I have the same versions of software as you do, and tried both
approaches before I post my last message, none of them works with my
local javadoc file
1. use %20 with/without quotes, eclipse shows "Location does not
exist"
2. use browse button, eclipse is ok, but firefox showed the error
3. use web docs in sun site, works. I'd try to get away from it, since
it needs internet connection.

Thanks,

Wei
 
I

Ian Wilson

wei said:
Ian,

I have the same versions of software as you do, and tried both
approaches before I post my last message, none of them works with my
local javadoc file
1. use %20 with/without quotes, eclipse shows "Location does not
exist"
2. use browse button, eclipse is ok, but firefox showed the error
3. use web docs in sun site, works. I'd try to get away from it, since
it needs internet connection.

Thanks,

Wei

I suspect the problem is in the way Eclipse launches Firefox which is
probably using WinXP file associations to launch your default browser.

Windows on this PC launches 'Firefox URL's using DDE "%1",,0,0,,,,
Maybe your registry entry lacks the quotes around %1?

I used Windows Explorer, Folder Options, File Types to find this.

Perhaps our history of updating Firefox/Mozilla differs and this lead to
a glitch on your PC?
 
W

wei

I suspect the problem is in the way Eclipse launches Firefox which is
probably using WinXP file associations to launch your default browser.

Windows on this PC launches 'Firefox URL's using DDE "%1",,0,0,,,,
Maybe your registry entry lacks the quotes around %1?

I used Windows Explorer, Folder Options, File Types to find this.

Perhaps our history of updating Firefox/Mozilla differs and this lead to
a glitch on your PC?

Ian,
I checked the settings on my pc, and it's the same as yours.
DDE "%1",,0,0,,,, with quotes around %1

and the application used to open html files is
C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "%1" -requestPending

Do you think it's a setting issue in Eclipse?

Thanks,

Wei
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top