0

I want to import DiskFileItemFactory class. But after adding libraries commons-fileupload.jar , commons-io.jar (Source zip files) to project i get this error:

import org.apache.commons.fileupload.*;
//Error: package org.apache.commons.fileupload does not exists

I am importing them in Beans component file. Server: GlassFish on NetBeans.

Malwinder Singh
  • 6,644
  • 14
  • 65
  • 103

2 Answers2

2

The mentioned package/classes are not present in the compiletime classpath. Basically, Java has no idea what you're talking about when you say to import this and that. It can't find them in the classpath.

drop the jars in /WEB-INF/lib folder of the project and this error should disappear.

You can download the jars from here commons-io and commons-fileupload

you can try these steps:

1.Right-click the project name (in the "Projects" window) -> New -> Folder, call it (say) "lib". Now open your file browser, navigate to that folder and drop all the custom libraries that you have.

2.Right-click the project -> Properties -> Libraries -> Compile (tab) -> Add JAR/Folder and add the jar files.

Imran
  • 429
  • 9
  • 23
0
  • If you use jar file you need to add it libraries folder.

  • If you use netbeans, then select your project and right click on
    libraries folder. It opens up a popup menu. Select Add JAR/Folder -> Select the path where your file is -> click on open button.

Your error will be disappear

CSchulz
  • 10,882
  • 11
  • 60
  • 114
Ashish
  • 1
  • 1
    You need to edit this answer to be step-by-step, not just a wall of text. Add bullet points and quotes etc to make it descriptive. Also, cite any outside sources if you have. – cst1992 May 24 '16 at 06:18