aspose file tools*
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
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
Author

NoClassDefFoundError When Running App from Batch File

Steve O Murphy
Greenhorn

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?

Thanks,
Steve

Contents of batch file


Runtime eror

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

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
Greenhorn

Joined: Nov 29, 2010
Posts: 7
Thank you Arek. I will give that a try.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError When Running App from Batch File