File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes java.lang.NoClassDefFoundError error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "java.lang.NoClassDefFoundError error" Watch "java.lang.NoClassDefFoundError error" New topic

java.lang.NoClassDefFoundError error

jill Na

Joined: Dec 05, 2010
Posts: 11

I have recently installed java on ubuntu.
But I am starting with Java after a long time now. Please help me ...

I have been getting this error -

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/servlet/ServletFileUpload

I am using these jar - /commons-fileupload-1.2.2 and commons-io-2.0.1.jar:

which I believe might be due to incorrectly set CLASSPATH ??

How to fix it?

Could you please help me with configurations I need to set up - I am listing what I know - please correct or add to it.
1 the /etc/environment file should have this

what else should I set up?

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

there is a build time classpath and runtime classpath.
You are printing your build time classpath - that is the classpath used when you build your code.
If you are deploying your code, put the JAR in the WEB-INF/lib directory and try again.
jill Na

Joined: Dec 05, 2010
Posts: 11
thanks worked.
I agree. Here's the link:
subject: java.lang.NoClassDefFoundError error
It's not a secret anymore!