I am trying to do the following import in java project:

import org.apache.commons.io.FileUtils;

This displays following error message in eclipse:

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

Kindly guide me on this error.

  • Are you using any dependency control like Maven? And when does that error happen? When you execute your code from IDE? or from CMD? if from IDE, which IDE are you using? – Alexey R. Apr 19 '18 at 10:32
  • Not using Maven, i am using eclipse to run the code written in java after importing selenium.jar file into the project. – Sudeept Apr 19 '18 at 11:05
  • I strongly recommend you to use Maven since I think "apache commons io" is not the only library you're missing. You would not see any import problems but when you run your code there would be ClassNotFound exception because a lot of libraries also depend on some other libraries, and you will have find, download and attach the corresponding jars to your project. – Alexey R. Apr 19 '18 at 11:10
  • I suppose you are right, i opened the website - maven.apache.org/download.cgi following your words and i am not sure about how to proceed with installation and maven usage ... – Sudeept Apr 19 '18 at 11:21
  • i have installed maven successfully. – Sudeept Apr 19 '18 at 14:58

You need the download the "org.apache.commons.io.jar" jar file. After that you have to add this downloaded jar in project lib and import it in class, it will work.


Not the answer you're looking for? Browse other questions tagged or ask your own question.