包org.apache.commons.io不存在错误

sam*_*ion 11 java apache ant lucene

我正在使用ant编译器编译.java文件.我收到以下错误"包org.apache.commons.io不存在错误"

我下载了apache Commons IO二进制文件并将.jar文件粘贴到"C:\ Program Files\Java\jdk1.7.0_51\lib\missioncontrol\plugins"中

任何帮助.我是否需要修改build xml文件的类路径?

<target name="compile" description="Compile source code">
<mkdir dir="${build.dir}/classes"/>
 <javac includeantruntime="false"
    srcdir="src"
       destdir="${build.dir}/classes"
       classpathref="classpath"
       encoding="UTF8"
       debug="on"
       deprecation="on">
  <include name="**/*.java"/>
  <exclude name="**/NutchExample.java"/>
 </javac>

 <copy todir="${build.dir}/classes/lia/tools">
   <fileset dir="src/lia/tools" excludes="**/*.java"/>
 </copy>
</target>
Run Code Online (Sandbox Code Playgroud)

小智 10

我有同样的问题,后来意识到公地IO的版本越来越拿起比我需要(2.4)什么....我需要重写,如下已经成功版本,以获得正确的回升下:

<dependency>
     <groupId>commons-io</groupId>
     <artifactId>commons-io</artifactId>
     <version>2.4</version>
 </dependency>
Run Code Online (Sandbox Code Playgroud)


小智 5

我也遇到了同样的问题,但是在 pom 中添加依赖项后,错误被删除了。

<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

您还可以参考网址 http://zetcode.com/java/fileutils/


小智 0

前往: http: //commons.apache.org/proper/commons-io/download_io.cgi 下载:commons-io-2.4-bin.zip 解压并在commons-io-2.4文件夹中找到commons-io-2.4.jar