Fixing scaladoc error “Cannot load the doclet class”

When running scaladoc with a custom generator, you can get the following error message:

error: Cannot load the doclet class com.garysieling.MicroformatScalaDoc 
(specified with -doc-generator): java.lang.ClassNotFoundException: 

Leaving the default settings will generate the html version of scaladoc.

Unfortunately there are seven or eight different classpath arguments to scaladoc, which makes it tricky to execute. The key argument is “-toolcp”.

If you’re writing a custom doclet, you need to depend on the build output of your project – with sbt this will be in the target/scala-2.11/classes:

export CLASSPATH=./target/scala-2.11/classes
scaladoc -verbose \
         -doc-generator com.garysieling.CustomScalaDoc \ 
         -toolcp $CLASSPATH \

If you want a good book on Scala, take a look at Programming Scala (I'm currently reading through this).

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *