Question

I have a doclet that prints the class data. I run the file from command line and it works fine. But, I want to run it within a java program also. So, I used the below main method in my doclet:

public class SimpleDoclet extends Doclet {

public static void main(String[] args) {
    System.out.println("====Starting the doclet=====");
    String[] args1 = { "javadoc -private -doclet "
            + SimpleDoclet.class.getName()
            + " -classpath /usr/java/jdk1.6.0_30/lib/tools.jar newPack/NewClass.java" };
    com.sun.tools.javadoc.Main.execute(args1);
}

NewClass.java is the java file that I want SimpleDoclet to generate javadoc. Can I do this?

If so, then when I run this doclet, I get this error message:

====Starting the doclet=====
javadoc: error - File not found: "javadoc -private -doclet oldPack.SimpleDoclet -classpath /usr/java/jdk1.6.0_30/lib/tools.jar newPack/NewClass.java"
1 error

Any solutions please?

Was it helpful?

Solution

You are specifying a single argument where you should be specifying several.

{"javadoc", "-private", ...}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top