Running ant build gives “package org.junit does not exist”

You should add your junit.jar into the classpath definition in your ant file.

There are many way to do it, one example is:

<junit printsummary="yes" haltonfailure="yes">
    <classpath>
        <path refid="your.classpath.refid" />
        <fileset dir="${junit.dir}">
            <include name="**/junit.jar" />
        </fileset>
    </classpath>
    ...
</junit>

See Ant Manual for details on setting up your classpath.

Leave a Comment