Java 如何在 Eclipse 中包含 Apache Commons IO?(爪哇)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1769889/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to include Apache Commons IO in Eclipse? (Java)
提问by rover12
How can I configure my Eclipse installation to use classes from Apache Commons IO?
如何配置我的 Eclipse 安装以使用来自 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
IOUtil 无法解析
采纳答案by VonC
You also can use build tools eclipse plugins like m2eclipseor IAM(formerly Q4e).
您还可以使用构建工具 eclipse 插件,如m2eclipse或IAM(以前称为Q4e)。
IAM can be be installed following those instructions, and ha s a great dependency viewer
可以按照这些说明安装 IAM ,并且有一个很棒的依赖项查看器
Differences between m2eclipse and IAM are discussed here, thereand here.
此处、此处和此处讨论了 m2eclipse 和 IAM 之间的差异。
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.
Q4E 是面向事件的,我相信 m2e 使用控制台和 stdin/out。
更大的一个是m2eclipse 分叉并使用外部 maven(用于运行 maven 目标)而
iam/q4e
只使用 embedder。
我们在这里的立场是,这是要走的路,允许深度集成和更好的性能。
它确实让我们能够在 maven 增量构建器中快速完成诸如依赖分析视图和其他一些“魔法”之类的事情。
回答by Mykola Golubyev
Download Apache .jar files and add them to library through your IDE (Eclipse).
下载 Apache .jar 文件并通过您的 IDE (Eclipse) 将它们添加到库中。
回答by Mike Q
What you need to do is this:
How to import a jar in Eclipse
你需要做的是:
How to import a jar in Eclipse