Reputation: 251
I'm trying to accomplish a very basic task and somehow can't seem to find how... I would like to have my Eclipse environment set in a way that I can get help and documentation on any standard class/method in the JDK, like I used to do a few years ago with Eclipse on Windows, where having the cursor on a class name (e.g. PrintWriter), and clicking Ctrl+F2 would open up the Java documentation for the PrintWriter class. Here's my environment:
Anyway, in Eclipse, putting the mouse over a class name, I get a brown dialog with a short explanation of the class. However, I don't know how to open up the full java documentation of the class. Also couldn't find anywhere in Eclipse a place to indicate where to take the java documentation from, nor which hotkey would bring the java documentation up.
I apologize for the many details, I'm just assuming they may be necessary to get a good answer.
Thanks!
/A
Upvotes: 7
Views: 12542
Reputation: 367
I was having a similar problem, and was having trouble accessing the Apple Developer page to download a local copy of the docs.jar. I went to Preferences > Java > Installed JREs > Edit, and then looked at the "Javadoc Location..." value for the jars. The Javadoc URI was still set to "http://java.sun.com/javase/6/docs/api/". When I changed it to "http://docs.oracle.com/javase/6/docs/api/" the tooltips started showing up again. Of course, this will only work when you are online.
Upvotes: 0
Reputation: 234
For everyone finding this StackOverflow-Post and not finding the src.jar: Apple removed it from the SDK and it's not supplied by default, however you can download it from Apple self at: http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.9.3.3.1 http://danbim.blogspot.com/2011/01/java-for-mac-os-x-106-update-3-and.html
P.S. Apple account is required (free registration)
Upvotes: 7
Reputation: 7139
I've had the same problem — previously I had been able access Java documentation and source directly in Eclipse, but that disappeared after one of the Java updates from Apple last year.
My solution was to manually add the source and Javadoc to the JRE definition in Eclipse. Here's how:
/Library/Java/JavaVirtualMachines/1.6.0_24-b07-334.jdk/Contents/Home/docs.jar
docs/api
now, optionally, you can set the source code too...
/Library/Java/JavaVirtualMachines/1.6.0_24-b07-334.jdk/Contents/Home/src.jar
In fact that 1.6.0_24-b07-334.jdk package is actually just a folder; it is treated as a single file by OS X but you can access its contents directly if you know the right path. What if you don't know what path the enter? You can browse the contents from Eclipse if you know this trick:
/Library/Java/JavaVirtualMachines
)1.6.0_22-b04-307.jdk
and 1.6.0_24-b07-334.jdk
)Contents/Home
etc where you should see appledocs.jar
, docs.jar
, src.jar
and other goodies.Upvotes: 11
Reputation: 40178
To bring up the Java documentation in Mac, move your mouse to the desired class, then click SHIFT+FN+F2
.
By the way, you can find out the shortcut key from Preferences -> General -> Keys -> type "Open Attached Javadoc". Here's my screenshot:-
Upvotes: 2
Reputation: 74760
Under /Library/Java/JavaVirtualMachines I have a file named 1.6.0_24-b07-334.jdk, which seems to be the new JDK I just installed. However, it's a single file, not expanded into directories and files. Right-clicking it and selecting "Show Package Content" shows me that deep inside it contains the files docs.jar and src.jar. However, not sure what I should be doing with the 1.6.0_24-b07-334.jdk file - should I leave it as is, or perhaps expand it to a full directory structure?
From what I remember from Mac OS (I had to use one two years ago for some months) I think this is not really a "single file", it only looks so in the file manager application. Look if you can navigate inside it in the file-chooser dialog of eclipse where you can select the docs.jar for your documentation.
Upvotes: 0