This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes New to Eclipse and Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "New to Eclipse and Java" Watch "New to Eclipse and Java" New topic
Author

New to Eclipse and Java

Paul Somnath
Ranch Hand

Joined: May 19, 2008
Posts: 177
Hi,
I am new to eclipse and Java. I want to link the Java API documentation with eclipse so that whenever I type in a program, I may able to see the corresponding documentation in the Java API documentation.
Say there is a line called Math.Random(); and I want to see all the documentation provided for the Math class in the Java API documentation.
Is this possible is eclipse? I think it should be..

Kindly provide a link or tell me how to do it.


Preparing for SCJP 6.0
Paul Somnath
Ranch Hand

Joined: May 19, 2008
Posts: 177
Ok, I found a way..
I have to edit the javadoc archive under rt.jar->properties..

But the problem is that it is not able to find 'package-list' and 'index.html' and is generating a error dialog box.. Whereas I can see that the package-list and index.html are both there in the folder:
C:\Program Files\Java\jdk1.6.0_06\docs\api

What might be the problem??
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1794
    
    7

Strange that you would have to manually configure the JavaDoc location.
I'm running Eclipse 3.4 (Ganymede) in combination with JDK 6 Update 7, and the JRE definition in Eclipse points to Javadoc location http://java.sun.com/javase/6/docs/api/ for all listed .jar files.
I guess, if you want to make the API docs available in an offline situation you would need to download the JDK 6 documentation and manually edit the Javadoc location to point to the documentation's installation directory.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Paul Somnath
Ranch Hand

Joined: May 19, 2008
Posts: 177
Originally posted by Jelle Klap:
Strange that you would have to manually configure the JavaDoc location.
I'm running Eclipse 3.4 (Ganymede) in combination with JDK 6 Update 7, and the JRE definition in Eclipse points to Javadoc location http://java.sun.com/javase/6/docs/api/ for all listed .jar files.
I guess, if you want to make the API docs available in an offline situation you would need to download the JDK 6 documentation and manually edit the Javadoc location to point to the documentation's installation directory.



Yes I found out that Eclipse has online help by pressing Shift+f2, but I want to do it offline.. And I am facing the problem as I told in my previous post, that it cannot find the package-list and index.html file in the javadocs location, and I can see in the windows explorer that they are actually there..
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1794
    
    7

I just downloaded the JDK 6 documentation from Sun's website, extrated the .zip file to my JDK installation directory, and pointed Eclipse to that location (file:/.../docs/api/) for rt.jar in my active JRE definition. Presto! Works perfectly. Can't imagine what the problem could be in your case.

Edit: Just noticed that extracting the documentation from the downloaded archive file isn't even necessary. You could simply point Eclipse to the .zip archive and the relative path to the "api" folder within that archive. Saves tons of time
[ August 16, 2008: Message edited by: Jelle Klap ]
Paul Somnath
Ranch Hand

Joined: May 19, 2008
Posts: 177
Originally posted by Jelle Klap:
I just downloaded the JDK 6 documentation from Sun's website, extrated the .zip file to my JDK installation directory, and pointed Eclipse to that location (file:/.../docs/api/) for rt.jar in my active JRE definition. Presto! Works perfectly. Can't imagine what the problem could be in your case.

Edit: Just noticed that extracting the documentation from the downloaded archive file isn't even necessary. You could simply point Eclipse to the .zip archive and the relative path to the "api" folder within that archive. Saves tons of time

[ August 16, 2008: Message edited by: Jelle Klap ]



Well now when I am pointing to the zip file, and point the path within archive to docs/api, it seems to locate the 'package-list' and 'index.html', but when I click vallidate, it opens a page not found !!
It opens this url:
http://127.0.0.1:60363/help/nftopic/jar:file:/C:/Program%20Files/Java/jdk-1_5_0-doc.zip!/docs/api/index.html and this page is not found..
Can anyone help?
[ August 16, 2008: Message edited by: Somnath Paul ]
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1794
    
    7

I just noticed you're pointing to a sub-directory in Program Files (default JRE installation directory on Windows), and I'm willing to bet that space in the path name is what's been tripping you up (notice the %20 encoding in the URL). This is precisely why I always avoid path names that contain spaces. Try moving the .zip file to another location, and it should work.

Edit: Confirmed my suspicion. When I move the .zip file to a location relative to Program Files I get the same errors you've been getting.
[ August 16, 2008: Message edited by: Jelle Klap ]
Paul Somnath
Ranch Hand

Joined: May 19, 2008
Posts: 177
Originally posted by Jelle Klap:
I just noticed you're pointing to a sub-directory in Program Files (default JRE installation directory on Windows), and I'm willing to bet that space in the path name is what's been tripping you up (notice the %20 encoding in the URL). This is precisely why I always avoid path names that contain spaces. Try moving the .zip file to another location, and it should work.

Edit: Confirmed my suspicion. When I move the .zip file to a location relative to Program Files I get the same errors you've been getting.

[ August 16, 2008: Message edited by: Jelle Klap ]


Not working
I moved the zip file to C:\
Still same problems..
http://127.0.0.1:60363/help/nftopic/jar:file:/C:/jdk-1_5_0-doc.zip!/docs/api/index.html

Could you paste the url for the index.html file in your system.. It may help me find out the problem..
[ August 16, 2008: Message edited by: Somnath Paul ]
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1794
    
    7

Have you tried accessing the documentation in a way other than the validation option? Validation seems to fail randomly here too, but even if it does I can still access the documentation via SHIFT-F2 etc.
Also, I noticed that you're using the J2SE 5.0 documentation in combination with the J2SE 6 JRE. That's not advisible.
[ August 17, 2008: Message edited by: Jelle Klap ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: New to Eclipse and Java