ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pedro Salgado <salgado...@04web.com>
Subject Re: java task NoClassDefFoundError
Date Fri, 16 Jan 2004 21:39:52 GMT
On 16/01/2004 20:06, "Dominique Devienne" <DDevienne@lgc.com> wrote:

>> From: Pedro Salgado [mailto:salgado.pc@04web.com]
>> 
>>   (I have already checked the manuals and verbose to see what is
>> happening).
>> 
>>   I am trying to execute a java task on the bin (${dir.build}) directory,
>> where my Junit test classes are and I get the following error:
>> 
>>  [java] 'com.pg.portonline.junit.actions.LoginTest'
>>      [java]
>>      [java] The ' characters around the executable and arguments are
>>      [java] not part of the command.
>>      [java] Exception in thread "main" java.lang.NoClassDefFoundError:
>> com/pg/portonline/junit/actions/LoginTest
> 
> Well, that means the main class in not in the classpath specified ;-)
> 
>>   The ant task:
>>         <java
>>             classname="com.pg.portonline.junit.actions.LoginTest"
>>             fork="true"
>>             dir="${dir.build}"
>>             failonerror="true"
>>             maxmemory="128m">
>>             <classpath>
>>                 <fileset dir="${dir.lib}">
>>                     <include name="**/*.jar"/>
>>                 </fileset>
>>                 <fileset dir="${dir.metadata}">
>>                     <include name="**/struts-*.xml"/>
>>                 </fileset>
> 
> XML files are of no use in the classpath usually...

  I know but I need them because I am using StrutsTestCase. It needs the
struts config files on the classpath to test the Struts actions. :)

> 
>>             </classpath>
>>         </java>
> 
> Are you missing your build/classes/ directory in the classpath?
> The verbose output shows you the actual classpath. Study it to
> make sure the class is in there. Java's telling you it ain't.
> 

  Well I have put only the java class I wanted on the classpath and the
problem continues:

        <java
            classname="com.pg.portonline.junit.actions.LoginTest"
            fork="true"
            dir="${dir.build}"
            failonerror="true"
            maxmemory="128m"
            >
            <classpath>
                <fileset dir="${dir.build}/com/pg/portonline/junit/actions">
                    <include name="**/*.class"/>
                </fileset>



            </classpath>
        </java>

  Output:

junit:
     [java] Executing
'/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Home/bin/java'
with arguments:
     [java] '-Xmx128m'
     [java] '-classpath'
     [java] 
'/Users/pedro/Projects/PG/PortOnline/webapp/bin/com/pg/portonline/junit/acti
ons/LoginTest.class'
     [java] 'com.pg.portonline.junit.actions.LoginTest'
     [java] 
     [java] The ' characters around the executable and arguments are
     [java] not part of the command.
     [java] Exception in thread "main" java.lang.NoClassDefFoundError:
com/pg/portonline/junit/actions/LoginTest

BUILD FAILED
file:/Users/pedro/Projects/PG/PortOnline/webapp/build.xml:237: Java
returned: 1
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:110)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 5 seconds

  Any ideas? :D

Pedro Salgado


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message