java - Trouble with generating custom javadoc; 'cannot find doclet' -
i'm having go @ creating custom javadoc generator using doclet
, i'm running issues.
i'm following the official documentation , had trouble including tools.jar
file in project, managed fix this.
my issue after running command...
javadoc -doclet listclass -docletpath . myclass.java
...i getting message...
javadoc: error - cannot find doclet class listclass
as said, i've been following tutorials official documentation, here code reference.
listclass.java
:
import com.sun.javadoc.*; public class listclass { public static boolean start(rootdoc root) { classdoc[] classes = root.classes(); (int = 0; < classes.length; ++i) { system.out.println(classes[i]); } return true; } }
and myclass.java
:
/** * documentation class */ public class myclass { public static void main(string[] args) { } /** * documentation static void method * * @param param parameter takes in */ public static void mystaticvoidmethod(string param) { } }
so asking why getting error posted above. if able provide more comprehensive guide of how doclet
works great well.
note: i'm using intellij ide project. here directory structure:
- .idea
- ...
- out
- ...
- src
- listclass.java
- myclass.java
- javadocgenerator.iml
you need compile listclass file. like:
javac -d . listclass.java -cp /path/to/tools.jar
doclet classes part of tools jar, you'll need include compile-time dependency.
then command
javadoc -doclet listclass -docletpath . myclass.java
should work.
edit
for project structure, if you're compiling root directory, make sure reference files through subdirectories, , make sure absolute windows paths double-quoted:
javac -d . ./src/listclass.java -cp "c:/program files/java/jdk1.8.0_66/lib/tools.jar"
this create compiled listclass file @ root of project, , there use javadoc command:
javadoc -doclet listclass -docletpath . ./src/myclass.java
it better create classes directory place compiled classes, opposed in root of project, i'm working structure you've provided. see documentation javac , javadoc more info.
Comments
Post a Comment