简体   繁体   English

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

[英]package org.apache.commons.io does not exist error

I am compiling a .java file using ant compiler.我正在使用 ant 编译器编译一个 .java 文件。 I am getting the following errror "package org.apache.commons.io does not exist error"我收到以下错误“包 org.apache.commons.io 不存在错误”

I downloaded the apache Commons IO binaries and pasted the .jar files in "C:\\Program Files\\Java\\jdk1.7.0_51\\lib\\missioncontrol\\plugins "我下载了 apache Commons IO 二进制文件并将 .jar 文件粘贴到“C:\\Program Files\\Java\\jdk1.7.0_51\\lib\\missioncontrol\\plugins”

Any help.任何帮助。 Do I need to modify the classpath of my build xml file?我需要修改我的构建 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>

I was having same issue then realized that the version of commons-io getting picked up was lower than what I need (2.4)....I need to Override the already managed version as below to get the right one picked up:我遇到了同样的问题,然后意识到获取的 commons-io 版本低于我需要的版本(2.4)。...我需要覆盖如下已管理的版本以获取正确的版本:

<dependency>
     <groupId>commons-io</groupId>
     <artifactId>commons-io</artifactId>
     <version>2.4</version>
 </dependency>

I also faced the same issue, but after adding dependency in pom error got removed.我也遇到了同样的问题,但是在 pom 错误中添加依赖项后被删除了。

<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
</dependency>

you can also refer URL http://zetcode.com/java/fileutils/你也可以参考 URL http://zetcode.com/java/fileutils/

前往: 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

尝试在外部添加jar, 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM