[antlr-interest] What's this NoClassDefFoundError nonsense?

Oti ohumbel at gmail.com
Tue Aug 14 14:12:36 PDT 2007


Stephen,

IMHO you cannot mix -classpath and -jar options when starting the java VM.
Either say
  java -jar your_jar
and add the other necessary .jar files to the classpath in the
MANIFEST of your_jar,
or put every .jar file after the -classpath option and indicate the
main class on the command line.

HTH a little.

Best wishes,
Oti.

On 8/14/07, Hardy, Stephen <Stephen_Hardy at rabbit.com> wrote:
> Java really gets me sometimes...
>
> Can anyone tell me what I'm doing wrong?  Here is the command I'm
> running (from the DOS prompt):
>
> "c:\program files\java\jdk1.6.0_02\bin\java" -classpath
> c:\antlr-3.0\lib\antlr-runtime-3.0.jar;c:\antlr-3.0\lib\stringtemplate-3
> .0.jar;  -jar c2dc.jar
>
> c2dc.jar is my app, which happily compiles (and _was_ running in the
> NetBeans IDE).  I can list (jar -tf) the contents of both
> antlr-runtime-3.0.jar and c2dc.jar and they appear to be ship shape and
> bristol fashion.  However, when I run the above command it gets the
> NoClassDefFoundError exception when doing something with
> org/antlr/runtime/CharStream, even though CharStream is clearly in the
> classpath.
>
> Of course, something must be terribly broken.  Any suggestions?
>
> Another clue: after performing a 'make clean' Ant target in Netbeans, I
> can no longer get it to run.  However in this case I am entirely using
> the command-line tools, no IDE.  Something is really screwed up - should
> I reinstall the JDK?
>
> Regards,
> SJH
>


More information about the antlr-interest mailing list