ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From not4google <>
Subject Re: How to specify xml configuration file from Ant Task
Date Mon, 05 Oct 2009 14:27:10 GMT

Hi here are some more details:

	<target name="antTaskTest" depends="compile">
		<copy file="src/java/jdbc.xml" tofile="jdbc.xml"/>
		<jar destfile="Output.jar">
			<zipfileset dir="build/classes" prefix="" />
				<attribute name="Main-Class" value="com.x.y.z.HelloWorld" />
				<attribute name="Class-Path" value="lib/spring.jar " />

As you can see I do copy the XML file to the JAR and have checked this and
its definitely there. 
The XML is called from the Java by the following:

ApplicationContext ac = new ClassPathXmlApplicationContext("jdbc.xml",

Am not sure if its on the classpath - was hoping to have that done from the
ant task if possible?

supareno wrote:
> not4google a écrit :
>> Hi all
>> I have some code which relies on a xml configuration file being
>> available. I
>> have built my JAR from ant ANT task and after looking in the JAR i can
>> see
>> that the file is there. 
>> However when I try and execute the JAR on Windows from the command line
>> e.g.
>> java -jar Test.jar I get an exception saying that the file could not be
>> found.
>> Please could someone give me some suggestions on how to resolve this?
>> Thanks
> what about your build file?
> can we see i?
> did you copy the file in your jar?
> is the xml file is in the classpath?
> how do you call it in your java program?
> if you don't give us more clues, we can't help you :-)
> supareno
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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