"The import org.apache.commons.fileupload cannot be resolved" does not go off despite adding lib

Prasanna picture Prasanna · Mar 31, 2013 · Viewed 9.1k times · Source

When I try to import

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

Eclipse shows an error,

The import org.apache.commons.fileupload cannot be resolved

I added these libraries but still this error does not go off.

commons-fileupload-1.3.jar
commons-fileupload-1.3-javadoc.jar
commons-fileupload-1.3-sources.jar
commons-fileupload-1.3-tests.jar
commons-fileupload-1.3-test-sources.jar

How should I correct this error?

Answer

Prasanna picture Prasanna · Apr 1, 2013

I had to add these libraries in the build path after which it worked. Eclipse did not do it by itself.