Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include Apache Commons IO in Eclipse? (Java)

Tags:

java

eclipse

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

like image 720
rover12 Avatar asked Nov 20 '09 11:11

rover12


3 Answers

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

like image 70
Mike Q Avatar answered Sep 28 '22 18:09

Mike Q


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.

like image 26
VonC Avatar answered Sep 28 '22 19:09

VonC


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

like image 36
Mykola Golubyev Avatar answered Sep 28 '22 20:09

Mykola Golubyev