PDA

View Full Version : Accessing Java API docs




pbw
Jul 2, 2009, 04:39 AM
I have downloaded the latest Java update, and the associated devdocs from ADC, and installed them. In the devdocs are the src.jar and docs.jar, at /System/Library/Frameworks/JavaVM.Framework/Versions/1.6.0/Home.

The docs.jar contains the compressed Java API docs, but is there a "Mac" way to access the APIs? I have extracted them and put them in a convenient location, so that I can access then with a browser, which is my most frequent way of looking at them. Is there another way?



wrldwzrd89
Jul 2, 2009, 07:37 AM
Do you use an IDE for your Java development? If you do, which one? The way you set up your IDE to look at the documentation depends on which IDE you use.

pbw
Jul 2, 2009, 08:48 AM
Thanks for the reply.

Yes, I use NetBeans and IntelliJ. I have no problem with setting up the docs for use in the IDEs - just tell them where the jar file is.

However, I frequently just browse the Javadocs, especially when I'm trying to find the right classes to do a particular job. That's when being able to browse with a browser comes in handy.

duggram
Jul 2, 2009, 08:54 AM
Now I don't understand your question. If you can access the JavaDocs from the IDE and you can browse them with your browser, what are you looking for?

iShater
Jul 2, 2009, 08:59 AM
Since a browser cannot read the contents of JARs, you will have to extract the java doc contents into a directory of your choice and view the HTML files from there.

sammich
Jul 2, 2009, 09:02 AM
Are you referring to something like this (http://java.sun.com/javase/6/docs/api/)?

iShater
Jul 2, 2009, 09:05 AM
Are you referring to something like this (http://java.sun.com/javase/6/docs/api/)?

Yep, he wants it local vs. going to the web to access it.

pbw
Jul 2, 2009, 09:06 AM
Since a browser cannot read the contents of JARs, you will have to extract the java doc contents into a directory of your choice and view the HTML files from there.

Exactly, and that's what I have done. My question is whether there is a procedure in place for doing just this, and putting the expanded docs into a standard location. It seems a bit of an oversight for Apple not to provide such a mechanism when they bundle up the src and the docs.

I saw a reference to a shell script that extracted the docs, in a thread from about 2002/3, for a much earlier version of Java, obviously. I was wondering whether there was a modern equivalent.

pbw
Jul 2, 2009, 09:07 AM
Yep, he wants it local vs. going to the web to access it.

Yep. It's useful to be able to access this stuff when I'm offline.

iShater
Jul 2, 2009, 09:08 AM
Exactly, and that's what I have done. My question is whether there is a procedure in place for doing just this, and putting the expanded docs into a standard location. It seems a bit of an oversight for Apple not to provide such a mechanism when they bundle up the src and the docs.

I saw a reference to a shell script that extracted the docs, in a thread from about 2002/3, for a much earlier version of Java, obviously. I was wondering whether there was a modern equivalent.

JARs are just zip files. Either use terminal to extract the contents or use a zip utility to extract it. I don't think there is really an "official" procedure for this.

sammich
Jul 2, 2009, 09:09 AM
Yep. It's useful to be able to access this stuff when I'm offline.

https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-6u10-docs-oth-JPR@CDS-CDS_Developer

If that link doesn't work then go to http://java.sun.com/javase/downloads/index.jsp and scroll down to find "Documentation". I'm hoping it should be what you're looking for. I followed roughly the same procedure when downloading the v5 api's a couple years back.

pbw
Jul 2, 2009, 09:42 AM
I'm new to Macs. On my Linux systems, I would grab the Documentation bundle for a release of the JDK, and unpack it into the JDK directory, so I would have a /docs directory at the top level of the JDK. This was done by hand, so I don't have a problem with that.

However, I thought there might be a "mac way". Apparently not. I just found this:
http://confluence.concord.org/display/CCTR/Get+local+copies+of+Mac+OS+X+Java+source+code+and+Javadoc

gwynevans
Jul 29, 2009, 05:34 AM
However, I thought there might be a "mac way". Apparently not. I just found this:
http://confluence.concord.org/display/CCTR/Get+local+copies+of+Mac+OS+X+Java+source+code+and+Javadoc

I'm in the same position! It looks as if there used to be a unjarJavaDocumentation.sh for earlier versions, that unpacked to roots such as /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/Documentation/Reference/doc/api/, but I've no idea where that would come from. (There's a Javadoc dashboard widget that looks in the above & equivalent roots for 1.4.2 & 1.6).

pbw
Jul 29, 2009, 05:15 PM
I'm in the same position! It looks as if there used to be a unjarJavaDocumentation.sh for earlier versions, that unpacked to roots such as /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/Documentation/Reference/doc/api/, but I've no idea where that would come from. (There's a Javadoc dashboard widget that looks in the above & equivalent roots for 1.4.2 & 1.6).

That's good to know. In that case, I'll try dropping the expanded docs into Resources/Documentation.