0

I am running into the next problem:

I am trying to run my very own and beautiful doclet in the console(Windows 7):

javadoc com.mypackages.api -sourcepath ./src/main/java/

Which leads me to a mountain of exceptions:

java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc
    at com.sun.tools.javadoc.AnnotationDescImpl.annotationType(AnnotationDescImpl.java:46)
    at com.sun.tools.doclets.internal.toolkit.util.Util.isDeprecated(Util.java:811)
    at com.sun.tools.doclets.formats.html.PackageWriterImpl.writeClassesSummary(PackageWriterImpl.java:114)

(always the same one).

Then, I found here in StackOverflow someone saying that it was an third-party-library-with-annotations issue ( StackOverFlow: Why am I getting a ClassCastException when generating javadocs? ). The solution looked to be in adding those libraries with annotations to the classpath, so I runned the next line:

javadoc com.mindmatics.mcashwebservice.remote.api -sourcepath ./src/main/java/ -docletpath ./all-libs/*.jar

And I am now receiving the next error:

javadoc: error - Illegal package name: "./all-libs/webservice-commons-1.0.2-SNAPSHOT.jar"

With all the libs included in the all-libs directory. Can anyoune explain me what am I doing wrong? Thank you very much :-)

PS: I am using JDK 1.6

Community
  • 1
  • 1
raspayu
  • 5,089
  • 5
  • 37
  • 50

2 Answers2

1

Looking at your target path: ./all-libs/*.jar

This is not going to be a proper package name with hyphens in it unfortunately. You'll need to get rid of the hyphen or convert it to an underscore.

Harlin
  • 1,059
  • 14
  • 18
  • Thanks, but I thought that with "docletpath" I could add the jars in a directory (I mean, ./all-libs/ is the directory in which I have all my libs), not a package name. – raspayu May 10 '12 at 07:36
1

it seems *.jar is expanded by shell into 1.jar 2.jar ...
listing jar files as -classpath dir1/1.jar:dir2/2.jar works for me.

fishautumn
  • 364
  • 3
  • 6