raspayu
raspayu

Reputation: 5139

javadoc doclet libs : Illegal package name or ClassCastException when running it

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

Upvotes: 0

Views: 3542

Answers (2)

fishautumn
fishautumn

Reputation: 384

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.

Upvotes: 1

Harlin
Harlin

Reputation: 1139

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.

Upvotes: 1

Related Questions