Reputation: 661
I have a java web program that implements a .jar and cannot compile without it. I have uploaded all of the files with appropriate directory names, but I do not know how to get the build.xml to know where to find the .jar. The jar file is in my src/program directory. I know I need to use the <classpath>
tag. Do I need to put it in my "compile" target inside of the <javac>
tag?
Upvotes: 4
Views: 8092
Reputation: 673
<?xml version="1.0" encoding="utf-8"?>
<project name="helloworld" default="compile" basedir=".">
<property name="project.src.dir" value="${basedir}/src"/>
<property name="project.lib.dir" value="${basedir}/src/program"/>
<property name="project.classes.dir" value="${basedir}/classes"/>
<path id="lib.path">
<fileset dir="${project.lib.dir}" includes="**/*.jar"/>
</path>
<target name="compile">
<javac srcdir="${project.src.dir}" includes="**/*.java" destdir="${project.classes.dir}" classpathref="lib.path"/>
</target>
</project>
Upvotes: 2