我想在我的
java项目中包含外部jar.我正在使用蚂蚁.外部.jar位于文件夹lib中.我的build.xml看起来像这样:
<?xml version="1.0" encoding="UTF-8"?> <project> <path id="classpath"> <fileset dir="lib" includes="**/*.jar"/> </path> <target name="clean"> <delete dir="build"/> </target> <target name="compile"> <mkdir dir="build"/> <javac srcdir="src" destdir="build" classpathref="classpath" /> </target> <target name="jar"> <mkdir dir="trash"/> <jar destfile="trash/test.jar" basedir="build"> <zipgroupfileset dir="lib" includes="**/*.jar"/> <manifest> <attribute name="Main-Class" value="com.Test"/> </manifest> </jar> </target> <target name="run"> <java jar="trash/test.jar" fork="true"/> </target> </project>
但它不起作用.当我想从外部.jar导入一些东西时,命令ant compile后出现错误:package com.something不存在..我应该编辑什么才能使它工作?
确切的错误:
Compiling 23 source files to xy/build xy/src/com/Test.java:5: package com.thoughtworks.xstream does not exist import com.thoughtworks.xstream.*; ^ 1 error