7

How can I configure my Eclipse installation to use classes from Apache Commons IO?

I want to use this code:

IOUtil.write(encoded, new FileOutputStream(new File("target-file.txt")))

But it gives the error:

IOUtil cannot be resolved

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
rover12
  • 2,806
  • 7
  • 27
  • 28
  • Do you use any build tool, i. e. Ant or Maven or Ivy? They can help you with dependency management. –  Nov 20 '09 at 11:33
  • refer me to a link to know more about them and there usage – rover12 Nov 20 '09 at 11:34
  • http://ant.apache.org/ http://maven.apache.org/ http://ant.apache.org/ivy/ –  Nov 20 '09 at 11:52
  • Duplicate of http://stackoverflow.com/questions/1770005/will-apache-ant-make-ioutil-class-usable – laura Nov 20 '09 at 11:59

3 Answers3

8

What you need to do is this: How to import a jar in Eclipse add jar

Community
  • 1
  • 1
Mike Q
  • 6,716
  • 5
  • 55
  • 62
4

Download Apache .jar files and add them to library through your IDE (Eclipse).

Mykola Golubyev
  • 57,943
  • 15
  • 89
  • 102
4

You also can use build tools eclipse plugins like m2eclipse or IAM (formerly Q4e).

IAM can be be installed following those instructions, and ha s a great dependency viewer

alt text

Differences between m2eclipse and IAM are discussed here, there and here.

Q4E is event-oriented, I believe that m2e uses the console and stdin/out.

A bigger one is that m2eclipse forks and uses an external maven (for running maven goals) while iam/q4e only uses the embedder.
Our position here is that it is the way to go, allowing deep integration and better performance.
It certainly has allowed us to quickly do things like the dependency analysis view and some other "magic" in the maven incremental builder.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250