wood burning stoves
The moose likes Java in General and the fly likes NoClassDefFoundError in jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "NoClassDefFoundError in jar file" Watch "NoClassDefFoundError in jar file" New topic

NoClassDefFoundError in jar file

Alf Fernandez

Joined: Sep 01, 2001
Posts: 13
I wrote a small MQ/Java program, which I encapsulate in a jar file.
If I include in the jar the com.ibm.mq classes, it works fine. But if I include only the classes that I have wrote, it launches de following exception, when run it:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/MQException
Im sure the PATH and CLASSPATH are ok, because if I execute:
javap com/ibm/mq/MQException
it shows all the methods of the class.
Some help will be apreciated. Thanks

Sean MacLean
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
What environment are you running your program in? It sounds as though the environment your running in does not the com/ibm/mq/MQException class in *its* classpath. For instance, you'll often have a situation where you system classpath allows you to compile fine but when run in a web server, the server cannot find some classes. This is because the web server starts up and uses it own classpath to initialize it's JVM instance. Just a thought.
I agree. Here's the link: http://aspose.com/file-tools
subject: NoClassDefFoundError in jar file
It's not a secret anymore!