File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes NoClassDefFoundError When Running App from Batch 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 When Running App from Batch File" Watch "NoClassDefFoundError When Running App from Batch File" New topic

NoClassDefFoundError When Running App from Batch File

Steve O Murphy

Joined: Nov 29, 2010
Posts: 7
I have an app that I'm developing in Eclipse, but which I start from a batch file (see below). (I start it from a batch file because even though the app is in progress, there are parts of it I can currently use, and I dont' want to have to start Eclipse to run the app.)
My app includes the use of classes in Apache's commons-net-2.2.jar. After I start the app
from the batch file, it runs fine until it needs to use the TelnetClient class in the jar file. At that point I get a NoClassDefFoundError for org/apache/commons/net/telnet/TelnetClient (see below, following the batch file contents).

I know for sure that the path to the jar file is correct. I also know that the TelnetClient class is in the jar.
Note: the app uses JNI so I have library.path in the batch file.

When I run the app directly from Eclipse it works fine.

I've done internet research on this, but I can't fix this specific problem.

Do you have any idea what's wrong?


Contents of batch file

Runtime eror

===== End runtime error ======
Arek Sokolowski

Joined: Jan 12, 2011
Posts: 8

I have no idea, what is wrong in you case, and I do not want to go through your very long batches.

Instead, I can propose you a general approach to problem like this.

First of all, make your problem smaller.
Write one, simple class which will use only TelnetClinet class. Put your class in the same directory, as jar with TelnetClient, and write a batch file to run it.
If it works - try extend this small code, step by step, up to working target application.
If it does not work (it does not happen ) - check your java-related envinroment variables (CLASSPATH especially)...
No, i do not belive, that it will not work
Describe your problem here again, if the simpliest case fails.
Have fun looking for problem!
Steve O Murphy

Joined: Nov 29, 2010
Posts: 7
Thank you Arek. I will give that a try.
I agree. Here's the link:
subject: NoClassDefFoundError When Running App from Batch File
jQuery in Action, 3rd edition