Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ant script not working

 
Pradeep Kumar
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a batch file in the current base directory. I tried running the batch file using the following command.

<?xml version="1.0" encoding="UTF-8"?>
<project name="batchFile" default="exec" basedir=".">
<target name="exec">
<echo>start execution</echo>
<exec dir="${basedir}" executable="batch" os="Windows NT">
<arg line="stop_copy_start"/>
</exec>

</target>
</project>

The echo is getting executed but there is no warning error or any intimation but the Build successfull message is getting displayed.
Can someone tell me how to run the batch file. THe os is windows xp service pack 2.

Thanks and regards,
Pradeep Kumar
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the value of the "os.name" property?
 
Pradeep Kumar
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How and where to test the os.name property.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just add a

<echo>${os.name}</echo>

to your script. The shown value is the one you should use for the os attribute of the exec task. Or perhaps you should use the osfamily attribute instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic