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.
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
Thank you Arek. I will give that a try.
subject: NoClassDefFoundError When Running App from Batch File