我正在 Eclipse 中编译一个项目。我有以下 ant 脚本,它符合我正在使用的 java 项目 import org.apache.xmlrpc.XmlRpc;
我已将 xmlrpc-2.0.1.jar 添加到名为 jar 的文件夹中,并在 ant 中构建路径,如下所示。我收到错误 “package org.apache.xmlrpc 不存在 [javac] import org.apache.xmlrpc.XmlRpc;
我是否缺少某些内容?
<?xml version="1.0" encoding="UTF-8"?>
<project name="buildFiles" default="compile">
<path id="compileClasspath">
<fileset dir="jar"/>
</path>
<target name="compile" description="compile the source " >
<javac srcdir="." destdir="build"/>
<classpath refid="compileClasspath"/>
</target>
</project>
感谢您的帮助。
最佳答案
jar 本身必须位于类路径中。不是包含 jar 的目录:
<path id="compileClasspath">
<fileset dir="jar">
<include name="xmlrpc-2.0.1.jar"/>
</fileset>
</path>
关于java - Eclipse Ant脚本编译包不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7969150/