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-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-specify-xml-configuration-file-from-Ant-Task-tp25714122p25751814.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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

Reply via email to