You have a classpath problem.

Your class is in a package called "teluswonderland" therefore your classpath should reference a directory that contains the directory "teluswonderland". One does not put class files in a classpath. One puts directories that contain classes and one puts jar/zip files.

Your path should be written to be

<path id="test.path">
<pathelement location="${basedir}/test"/>
</path>


Joseph Yang wrote:

Hello all,

I am very new to ant, I need some help please (I have searched the mail
archive...), I am trying to run junit test using ant, in build.xml

<path id="test.path">
       <fileset dir="${basedir}/test">
           <include name="*.class"/>
       </fileset>
</path>

   <target name="runtests" depends="compiletests">
        <junit fork="yes" haltonerror="no" haltonfailure="no"
printsummary="yes" >
            <classpath refid="test.path"/>
            <test fork="true" name="teluswonderland.AllTests" haltonfailure="yes"
outfile="result">
                <formatter type="xml"/>
            </test>
        </junit>
   </target>

When I run the test, it keeps giving me error as below, how to solve this?

 <error message="teluswonderland.AllTests"
type="java.lang.ClassNotFoundException">java.lang.ClassNotFoundException:
teluswonderland.AllTests
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:115)
</error>

Thanks


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




-- Erik Husby Team Lead for Software Quality Automation Whitehead Institute/MIT Center for Genome Research Rm 2192 320 Charles St Cambridge, MA 02141-2023 mobile: 781.354.6669 office: 617.258.9227 [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to