ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From supareno <reno.rkc...@free.fr>
Subject Re: How to specify xml configuration file from Ant Task
Date Mon, 05 Oct 2009 17:44:11 GMT
not4google,

for me the file is not in the classpath...
2 possibilities:
1) adding it the classpath (after copying it to the lib folder)
2) adding the xml file to the jar (copying it the build/classes folder)

after that, it may work !

hope this help

supareno
> 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="" />
> 			<manifest>
> 				<attribute name="Main-Class" value="com.x.y.z.HelloWorld" />
> 				<attribute name="Class-Path" value="lib/spring.jar " />
> 			</manifest>
> 		</jar>
> 	</target>
>
> 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",
> HelloWorld.class);
>
> 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: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>>     
>
>   



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


Mime
View raw message