Q: How to make ANT send the output of a Java program to a particular file? I have a Java program that outputs images in jpg format. As it stands, my ANT script sends all these images to the same file where it writes the compiled java classes (the bin directory, called build.dir in ANT). I want to make it send the images to a separate file called "images". Here are the relevant snippets:
  <property name="source.dir" location="src"/>
  <property name="build.dir" location="bin"/>
  <property name="images.dir" location="images"/> 
  <property name="doc.dir" location="doc"/>
  <property name="main.class" value="project5.Main"/>

  <target name="init" description="setup">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${images.dir}"/> 
    <mkdir dir="${doc.dir}"/>
  </target>

<target name="compile" depends="init" description="compile">
    <javac includeantruntime="false" srcdir="${source.dir}" destdir="${build.dir}"/>
  </target>


  <target name="run" depends="compile" description="run">
    <java dir="${build.dir}" classname="${main.class}" fork="yes">
        <arg line="${args}"/>
    </java>
  </target>

I believe it should be added command to the compile task but I cannot find which one.

A: Posting a snippet from your program that shows how you are writing the images would be helpful. You probably need to make your program understand an argument that indicates the images directory. Then pass the images.dir value as an arg in the java call in Ant. You can then use the value of that arg in your app to write your images to the correct location.
