问题
Has anyone used XHTML Doclet, and can you provide some hints as to how to get it to work successfully?
I run it like this:
\sunjdk\bin\javadoc -doclet net.sourceforge.xhtmldoclet.Doclet
-docletpath c:\sw\java\XHTML_Doclet_0.4.jar -d <output>
[class files here]
(all on one line)
When I run it I get this:
javadoc: error - In doclet class net.sourceforge.xhtmldoclet.Doclet, method validOptions has thrown an exception java.lang.reflect.InvocationTargetException
java.lang.Error: Fatal: Resource (net.sourceforge.xhtmldoclet.resources.doclet) for javadoc doclets is missing.
at com.sun.tools.doclets.internal.toolkit.util.MessageRetriever.getText(MessageRetriever.java:110)
at com.sun.tools.doclets.internal.toolkit.util.MessageRetriever.getText(MessageRetriever.java:92)
at com.sun.tools.doclets.internal.toolkit.util.MessageRetriever.getText(MessageRetriever.java:81)
at com.sun.tools.doclets.internal.toolkit.Configuration.getText(Configuration.java:634)
at com.sun.tools.doclets.internal.toolkit.Configuration.generalValidOptions(Configuration.java:515)
at net.sourceforge.xhtmldoclet.Config.validOptions(Unknown Source)
at net.sourceforge.xhtmldoclet.Doclet.validOptions(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
at com.sun.tools.javadoc.DocletInvoker.validOptions(DocletInvoker.java:198)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:317)
at com.sun.tools.javadoc.Start.begin(Start.java:128)
at com.sun.tools.javadoc.Main.execute(Main.java:41)
at com.sun.tools.javadoc.Main.main(Main.java:31)
1 error
It seems like it ought to just work. What am I doing wrong?
回答1:
XhtmlDoclet appears to have a bug in its resource handling. I've submitted a bug and a patch to fix it here: https://sourceforge.net/tracker/?func=detail&aid=3006429&group_id=199009&atid=967765
The bug happens when the doclet is trying to output user-visible text, so it's probably trying to print an error message which you can't see because of the bug.
回答2:
\sunjdk\bin\javadoc -classpath c:\sw\java\XHTML_Doclet_0.4.jar
-doclet net.sourceforge.xhtmldoclet.Doclet
-docletpath c:\sw\java\XHTML_Doclet_0.4.jar -d <output>
[class files here]
all on one line
来源:https://stackoverflow.com/questions/2533556/java-xhtml-doclet-fatal-exception