ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Yang" <>
Subject RE: Junit test problem
Date Fri, 06 Jun 2003 18:48:00 GMT
Thanks all for the responses!

After I did what you told me here, another type of error shows up as below
(I searched the mail archive again...)

I did put junit.jar in ANT_HOME/lib, any idea?


Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
 - You have misspelt 'junit'.
   Fix: check your spelling.
 - The task needs an external JAR file to execute
   and this is not found at the right place in the classpath.
   Fix: check the documentation for dependencies.
   Fix: declare the task.
 - The task is an Ant optional task and optional.jar is absent
   Fix: look for optional.jar in ANT_HOME/lib, download if needed
 - The task was not built into optional.jar as dependent
   libraries were not found at build time.
   Fix: look in the JAR to verify, then rebuild with the needed
   libraries, or download a release version from
 - The build file was written for a later version of Ant
   Fix: upgrade to at least the latest release version of Ant
 - The task is not an Ant core or optional task
   and needs to be declared using <taskdef>.

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.

-----Original Message-----
From: Erik Husby []
Sent: Friday, June 06, 2003 11:29 AM
To: Ant Users List
Subject: Re: Junit test problem

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"/>

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"
>	        <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"
>	at$
>	at Method)
>	at
>	at java.lang.ClassLoader.loadClass(
>	at sun.misc.Launcher$AppClassLoader.loadClass(
>	at java.lang.ClassLoader.loadClass(
>	at java.lang.ClassLoader.loadClassInternal(
>	at java.lang.Class.forName0(Native Method)
>	at java.lang.Class.forName(
>To unsubscribe, e-mail:
>For additional commands, e-mail:

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

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message