File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes noClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "noClassDefFoundError" Watch "noClassDefFoundError" New topic


Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
i have jdk5 installed in win xp sp2
when i do java <filename>
i get the error on my machine
Exception in thread "main" java.lang.NoClassDefFoundError: <filename>
i correct it by doing
java -cp . <filename>
then it runs fine.

but on running a client ejb program on the command line
AppClient -client <filename>
i again get the error
WARNING: ACC003: Application threw an exception.
java.lang.NoClassDefFoundError: converter.ConverterHome
where converter.ConverterHome is contained in the jar file

i do not get a solution to this problem
how can i correct the above problem or the overall problem such that
when i give the command
java <filename>
i get the output simply
any helps

Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
You need to set your classpath to point to the directory your class files are stored and also you will need to add each jar file individually to the classpath.
Edster Lamb

Joined: Nov 14, 2004
Posts: 2
I had the exact same problem.
I had to do this ..

cd C:\PROGRA~1\Java\j2eetutorial\examples\src\ejb\converter
set APPCPATH=ConverterAppClient.jar
runclient -client ConverterApp.ear -name ConverterClient -textauth -Dj2eelogin.password=guest123

I hope that helps.
Sydney Holiday Accommodation - Sydney Apartments
I agree. Here's the link:
subject: noClassDefFoundError
jQuery in Action, 3rd edition