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:
org/apach
e/poi/hssf/usermodel/HSSFWorkbook
I basically took the basic example code from here and tweaked it a bit:
http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html#enhance
I tried using this, nested under both <javac> and <java>:
<classpath>
<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"/>
</classpath>
I also tried putting this under the <manifest> tag of <jar>:
<attribute name="Class-Path" value="C:/poi-3.2-FINAL-20081019.jar
C:/poi-contrib-3.2-FINAL-20081019.jar
C:/poi-scratchpad-3.2-FINAL-20081019.jar"/>
Am I doing everything right? Should this work? How can I get those files
included?
Thanks.
--
View this message in context:
http://www.nabble.com/How-do-I-reference-external-JARs-when-running-a-Java-program-from-Ant--tp21572014p21572014.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]