ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astyrrian17 <>
Subject How do I reference external JARs when running a Java program from Ant?
Date Tue, 20 Jan 2009 21:26:03 GMT

I have a java program that uses external jars (Apache POI files). I used
eclipse to code this small program and it works just fine. This program
referenced those external jars succesfully.

Now I want to use ant to run this program and provide inputs. I intend to
compile, create the jar from ant, and then run it.

The program compiles, but I keep getting this following error:

     [java] Exception in thread "main" java.lang.NoClassDefFoundError:

I basically took the basic example code from here and tweaked it a bit:

I tried using this, nested under both <javac> and <java>:

   <pathelement location="C:/poi-3.2-FINAL-20081019.jar"/>
   <pathelement location="C:/poi-contrib-3.2-FINAL-20081019.jar"/>
   <pathelement location="C:/poi-scratchpad-3.2-FINAL-20081019.jar"/>

I also tried putting this under the <manifest> tag of <jar>:

<attribute name="Class-Path" value="C:/poi-3.2-FINAL-20081019.jar

Am I doing everything right? Should this work? How can I get those files

View this message in context:
Sent from the Ant - Users mailing list archive at

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

View raw message