ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Klein <>
Subject Re: classsnotfound exception with junit ant task
Date Wed, 16 Aug 2006 19:05:22 GMT
cmose wrote:

>classpath.project is defined thusly:
><path id="classpath.project">
>   <pathelement path="${target.dir}" /> --->this is the bin directory for
>class files
>   <pathelement path="D:\Lirbaries\*.jar" /> ---> a temporary location for
>jar libraries
Where in this classpath is the missing class supposed to be found?  If 
it's supposed to be in the second pathelement above, there's a couple 
things to check.

The "Lirbaries" is a typo of "Libraries" (check what the actual 
directory is called). Also, I don't know if the wildcard (*.jar) is 
allowed in a path attribute value.  If not, then that pathelement might 
not be doing anything.

>Now the obnoxious thing is this, Ant runs the junit tests and manages to get
>through 65 out of the 72 testcases before throwing the classnotfound
>exception. Furthermore,
>The class it's saying it can't find, it found in a testcase it ran previous
>to the failed testcase (e.g., ClassNotFoundException: MyClass, MyClass was
>already exercised in a previous testcase that the ant junit task ran without
Was MyClass "exercised" the same way that the failed test uses it?  I 
wonder if it's possible that MyClass appears to be exercised in the 
passing test but isn't.  A simple statement like 
System.out.println(MyClass.class.getName()) should force it to be loaded 
so you can confirm whether it can be found or not.

Are there by any chance any classloaders involved in this whole mess 
that could be finding MyClass a different way than the classpath in the 
test that uses it but doesn't fail?

Joel Klein                    [Online at]

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

View raw message