my dog learned polymorphism*
The moose likes Java in General and the fly likes Javadoc on Jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Javadoc on Jar" Watch "Javadoc on Jar" New topic

Javadoc on Jar

Yoo-Jin Lee
Ranch Hand

Joined: Nov 01, 2000
Posts: 119
Can anyone enlighten me on how to generate javadoc comments on jar files by: javadoc ....
I can do it for regular files but when I set the sourcepath to the jar file that contains all my classes I get errors.
Thanks in advance.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
I don't believe that you CAN create JavaDoc out of a Jar file.

JavaDoc Options
As parameters to JavaDoc, you can specify a single source file, multiple source files, or package names. If you specify a package name, you will get documentation for all the classes in the package, including a class hierarchy and an index. Javadoc searches your CLASSPATH for the specified files. To include directories that are not in your classpath, you can specify -classpath parameter to Javadoc to add those.
-classpath (specify the classpath to use)
-sourcepath (specify where the source files (.java) are, not the .class files.)
-version (If a version tag is found, it will be included in the documentation)
-author (If an author tag is found, it will be included in the documentation
-noindex (do not generate index)
-notree (do not generate tree information)
-d (specify the directory for the output files)
-verbose (produce a detailed listing from the JavaDoc compilation)

There is no mention in this of a source jar being an input.
However, there is nothing stopping you from decompressing the jar into a temp directory, running the utility against the source files and then deleting the temp directory. Any unzip or File Librarian type of utility will unzip them... I peek at one or two all the time.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Yoo-Jin Lee
Ranch Hand

Joined: Nov 01, 2000
Posts: 119
Thanks for your reply. I was hoping I wouldn't have to extract everything, but I guess really it's no big deal.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

You still don't have to extract everything.
You could use the -t option of jar
to get a list table of contents for archive
jar -t myJarFileName.jar
Is this what you are looking for?
- satya

Take a Minute, Donate an Hour, Change a Life
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Well, that does get you a table of contents, but not the JavaDoc for those classes.
jQuery in Action, 2nd edition
subject: Javadoc on Jar
Similar Threads
Javadoc and RAD7 content assist
Is there a JavaRanchCommon doc package?
javadoc using class files
Eclipse and Javadoc
How to add JMF JavaDoc to NetBeans?