Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes JavaDoc Reader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JavaDoc Reader" Watch "JavaDoc Reader" New topic

JavaDoc Reader

Rishita Pallavi

Joined: Jun 27, 2009
Posts: 7

I have a requirement to load class files/jars and then read javadoc from it.
How can this be done??

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41176
Javadocs are generated from source files, not class files, so having the jar file is not sufficient. What's more, javadocs are generated from source code comments -which are not preserved in the class file- there's not even a theoretical way to generate them from class files.

Ping & DNS - my free Android networking tools app
Rishita Pallavi

Joined: Jun 27, 2009
Posts: 7
are you sure? But we use ant scrit to generate java docs from jars. We dont give Source file as input anywhere there.
So i am sure, javadoc gets preserved in the class files.
Just wan to know if there is any exising API solving the purpose.
John de Michele

Joined: Mar 09, 2009
Posts: 600

Sorry, but class files do not preserve comments. However, it is common practice (at least on open source projects, anyway) to jar up source code and/or javadocs. It sounds like that's what your ant build.xml file is doing.

jQuery in Action, 2nd edition
subject: JavaDoc Reader
Similar Threads
Open firefox window and redirect to a url
synchronize on writes but not on reads.
how to get the client's bowser URL who's hitting your service from ajax call?
Matually Comparable
CAPS, lowercase, and numbers