NoClassDefFoundError using Javadoc on Unix
I am attempting to use Javadoc on a Unix machine. I always get this error:
java.lang.NoClassDefFoundError: java/util/ArrayList
at sun.tools.java.ClassDefinition.<init>(Compiled Code)
at sun.tools.javac.SourceClass.<init>(Compiled Code)
at sun.tools.javac.BatchEnvironment.makeClassDefinition(Compiled Code)
at sun.tools.java.Environment.makeClassDefinition(Compiled Code)
at sun.tools.java.Environment.makeClassDefinition(Compiled Code)
etc . . .
I have tried to include the "src.jar" in the "-sourcepath" and various other things. I have no trouble using "javac" or any other tool. What is going on here? Why can't this tool find the proper class definitions? I have no trouble using Javadoc on NT. Any thoughts?
[803 byte] By [
7knm7] at [2007-9-26 6:50:06]

Hmmm, src.jar. Are you trying to run javadoc on the source code
in src.jar?
-sourcepath won't work with jar files -- please unjar the source files. If the source files are in /home/me/src/java/util/ArrayList/*.java,
then use "-sourcepath /home/me/src"
By the error message, it looks like it cannot find ArrayList.class,
which is located in rt.jar (not src.jar). You shouldn't need
to add rt.jar to your -classpath.
Please include the command you are executing.
-Doug Kramer
Javadoc team
> Hmmm, src.jar. Are you trying to run javadoc on the
> source code
> in src.jar?
>
> -sourcepath won't work with jar files -- please unjar
> the source files. If the source files are in
> /home/me/src/java/util/ArrayList/*.java,
> then use "-sourcepath /home/me/src"
>
> By the error message, it looks like it cannot find
> ArrayList.class,
> which is located in rt.jar (not src.jar). You
> shouldn't need
> to add rt.jar to your -classpath.
>
> Please include the command you are executing.
>
> -Doug Kramer
> Javadoc team
Hello and Thanks for the response.
The command I am entering is:
javadoc -version -author -private com.xxx.xxx.packagename
I enter this command at the level above "com."
The response I get is java.lang.NoClassDefFoundError: java/util/ArrayList , etc.
My classpath variable is set in my .cshrc file (this is Unix). If I add rt.jar to the classpath, the foregoing command results in a core dump rather than the error mentioned. I am completely confused!! I have no problem with Javadoc in NT, by the way.
7knm7 at 2007-7-1 16:17:10 >

Thanks for the command. It looks correct.
Please provide more information:
- Which version of Javadoc are you using?
- What is your classpath set to?
It appears the classpath is not set correctly, as it is looking
in the wrong place for the ArrayList class.
You should not set classpath to load any Java platform packages,
as these are automatically loaded. Use it to load only your own
referenced classes.
- For kicks, try adding "-sourcepath ." If "com" is in the
current directory, this ensures javadoc looks there for the package
source files.
-Doug Kramer
Javadoc team
> Thanks for the command. It looks correct.
> Please provide more information:
>
> - Which version of Javadoc are you using?
>
> - What is your classpath set to?
> It appears the classpath is not set correctly, as
> as it is looking
> in the wrong place for the ArrayList class.
> You should not set classpath to load any Java
> va platform packages,
> as these are automatically loaded. Use it to load
> oad only your own
> referenced classes.
>
> - For kicks, try adding "-sourcepath ." If "com" is
> in the
> current directory, this ensures javadoc looks there
> re for the package
> source files.
>
> -Doug Kramer
> Javadoc team
Doug
Thanks for your help. Your question about Javadoc version was the key. My "javadoc" command was being pulled from the wrong bin. I apparently was pointing to an old jdk. Using javadoc from jdk 1.3 works just fine.
7knm7 at 2007-7-1 16:17:10 >
