Reading JavaDoc from Code

If I have a folder structure with .java files in it, and I want to point JavaDoc at it and have it tell me JavaDoc info, how do I do that? One way is to extend Doclet, but then I can only call it from the command line with javadoc -doclet ... However, what if I just want to do it from ordinary code?

[307 byte] By [millea@fnal.gova] at [2007-10-2 21:46:03]
# 1
Running the Standard Doclet Programmatically: http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/standard-doclet.html#runningprogrammatically
dhkramera at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
Do you know how my Doclet class could communicate with the rest of the program, if I invoked JavaDoc in this way?
millea@fnal.gova at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3
Sorry, I don't know.-Doug
dhkramera at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 4
Thats cool thanks anyway.Maybe this will help, does anyone know how Eclipse or Netbeans reads and displays the Javadoc info when you import a library? Do you think they just have their own parsers, or do they do it through the javadoc api?
millea@fnal.gova at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 5

What I ended up doing was this. Using the execute() method you mentioned I run a custom Doclet on my files, and the Doclet connects back to the program using Sockets and gives back the information I needed. This would have been extremely easy if the DocImpl classes were Serializable, but unfortunately (like any other useful Java class Ive ever tried to serialize), they're not. I eneded up just passing a Map of method names and descriptions, which basically worked all right. Hope this helps someone!

millea@fnal.gova at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 6

Looks like you found a solution. Here are a couple of belated answers, passed along from an engineer...

> Do you know how my Doclet class could communicate with the rest of the program?

The easiest (not really clean) might be to just create a singleton for

communication, which is shared by all instances of the doclet, and

whatever other point in the program care about it.

> Does anyone know how Eclipse or Netbeans reads and displays the Javadoc info when you

> import a library? Do you think they just have their own parsers, or do they do it through

> the javadoc api?

Eclipse has its own parsers. Netbeans uses javac. - Hey, Netbeans

comes from Sun, you'd expect that.

dhkramera at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 7
Wow using a Singleton turns out to be so much easier, and thread safe. I didn't realize that a static field would be shared across both my program and the process which was running the doclet. Thanks!
millea@fnal.gova at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 8
Glad it works!
dhkramera at 2007-7-14 1:01:38 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...