问题
I'm developing an Java-Application under OS X Lion and i want to use the Apple Extensions in Java 7.
My Question is simple:
I put the Apple Extensiosn into my Classpath, they are located here: /System/Library/Java but I can't find any JavaDocs in that directory.
Where are these Extensions explained? Is there JavaDoc available?
Just found that site: http://developer.apple.com/library/mac/#releasenotes/Java/JavaSnowLeopardUpdate3LeopardUpdate8RN/ResolvedIssues/ResolvedIssues.html#//apple_ref/doc/uid/TP40010380-CH3-DontLinkElementID_12 but wasn't really helpful.
To say it again, I'm not searching the JavaDoc for the JDK iteself, I'm searching for the JavaDoc from these Java-Apple-Extensions.
EDIT: JavaDoc for the Pointer Class for example
回答1:
Unfortunately, as far as I can tell, a javadoc for the Apple Java Extensions does not seem to be included in the download for OpenJDK 7. There are 3 ways (AFAIK) to get around this.
Download the source code for the JDK, then make the javadoc yourself:
This is the hardest way, but the most thorough. You must have
hg
(mercurial) installed to get the source code for OpenJDK. If it isn't installed already, you can install it with homebrewbrew install hg
or MacPortssudo port install hg
.After installing
hg
, you can download the source code for the JDK:For java 7:
hg clone http://hg.openjdk.java.net/jdk7u/jdk7u/jdk jdk
For java 8:
hg clone http://hg.openjdk.java.net/jdk8/jdk8/jdk jdk
Now that you've downloaded the source, you just need to make the javadoc.
To build the javadoc just for the Apple Java Extensions:
javadoc -d doc $(find jdk/src/macosx/classes/apple jdk/src/macosx/classes/com/apple -name *.java)
To build the javadoc for the entire JDK (including Apple Java Extensions):
javadoc -d doc $(find jdk/src/macosx/classes/ -name *.java)
If you use Java 8 to build the javadoc, you'll have to supply
-Xdoclint:none
as an additional argument tojavadoc
to make it work.Either of these will put all of the docs in a folder called
doc
in the current directory. You can delete thejdk
folder afterwards (that's where the JDK source got put).Use an old version (from Apple's java 6).
Apple's downloads of java 6 (only the developer JDK) included the javadocs for the Apple Java Extensions. AFAIK they have not changed since then, so it shouldn't matter that it's old (although it will have a different javadoc style). Currently, Apple's java developer package is available from https://developer.apple.com/downloads/index.action?q=java, but they change around
developer.apple.com
rather often, so that link will probably break pretty soon.Once you download and install this, it will install a new JDK in
/Library/Java/JavaVirtualMachines/
called1.6.0_something
. Inside this (Right Click → Show Package Contents), inContents/Home
, isappledocs.jar
, which contains the javadoc you are looking for.Use mine.
I compiled a javadoc for Apple Java Extensions using the exact same methods I described in section 1. I'm not going to keep it up to date, but AFAIK they're not still updating Apple Java Extensions, so it shouldn't matter.
- Java 6 (taken from Apple Java 6)
- Java 7 (built from OpenJDK 7)
- Java 8 (built from OpenJDK 8)
来源:https://stackoverflow.com/questions/14549629/javadoc-location-from-apple-extensions