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

Ulf Ochsenfahrt ulf at ofahrt.de
Tue Aug 14 14:12:02 PDT 2007


Hardy, Stephen 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

If I remember correctly, You can't use both -classpath and -jar. If you 
use -jar, the -classpath option is ignored. Try listing c2dc.jar with 
the -classpath option and then name the main class directly. 
Alternatively, you can try adding the classpath reference to the antlr 
runtime to your MANIFEST. I don't know the syntax offhand, but can look 
it up if you can't figure it out.

> 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.

Cheers,

-- Ulf


More information about the antlr-interest mailing list