<p>I have an Ant script with a junit target where I want it to start up the VM with a different working directory than the basedir. How would I do this?</p>

<p>Here's a pseudo version of my target.</p>

<pre><code>&lt;target name="buildWithClassFiles"&gt;
    &lt;mkdir dir="${basedir}/UnitTest/junit-reports"/&gt;
    &lt;junit fork="true" printsummary="yes"&gt;
        &lt;classpath&gt;
            &lt;pathelement location="${basedir}/UnitTest/bin"/&gt;
            &lt;path refid="classpath.compile.tests.nojars"/&gt;
        &lt;/classpath&gt;
        &lt;jvmarg value="-javaagent:${lib}/jmockit/jmockit.jar=coverage=:html"/&gt;
        &lt;formatter type="xml" /&gt;
        &lt;test name="GlobalTests" todir="${basedir}/UnitTest/junit-reports" /&gt;
    &lt;/junit&gt;

&lt;/target&gt;
</code></pre>

Have you tried:
```
```
<junit fork="true" printsummary="yes" dir="workingdir">
```
```