Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Classpaths in build file not working properly

Classpaths in build file not working properly

2007-06-12       - By Daniel Gresh

Hi,

I have a build file, and in that build file I'm setting up my classpath
and assigning it. However, when I try to run my compiled code, I get a
NoClassDefFoundError: service/ImageProcessor.

When I run my code and set the classpath manually using the -cp argument
to the java command, the program executes fine. Here is the command I
use that works:

java -cp
/u/dgresh/Ice-3.1.0/lib/Ice.jar:.:$CATALINA_HOME/webapps/kdb/WEB-INF/classes
vigra.ice.LOTFClient

*Note: service/ImageProcessor's full path is:
$CATALINA_HOME/webapps/kdb/WEB-INF/classes/service/ImageProcessor.

In my buildfile, here is the code I use to set up my classpath:

   <!-- Define the Java classpath -->
   <path id="classpath">
       <pathelement location="." />
       <pathelement
location="${CATALINA_HOME}/webapps/kdb/WEB-INF/classes" />
       <pathelement location="/u/dgresh/Ice-3.1.0/lib/Ice.jar" />
   </path>

I know $CATALINA_HOME is correct, as I use it with the ant reload
argument to reload my web app on Tomcat. Here is how I compile the code:

   <!-- Compile the Java code -->
   <target name="compile" depends="init">
       <javac srcdir="${src}" destdir="${build}/LOTFVigra" source="1.4"
target="1.4">
           <classpath refid="classpath" />
       </javac>
   </target>

As you can see, the two classpaths are identical. I have no idea what is
causing this problem.

Does anyone have any advice?

Thanks,
Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.