This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Executing batch file from ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Executing batch file from ANT" Watch "Executing batch file from ANT" New topic
Author

Executing batch file from ANT

v jain
Greenhorn

Joined: Jun 16, 2004
Posts: 4
hi,

I am relatively new to ANT. I am trying to run a batch file using ANT's exec tag. But it is generating an Error 2 while executing the command. Can anybody tell me the process to execute a batch file. Its urgent...
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2559

I think you need to execute command shell (comd, commnad??) first using exec task and then pass name of the batch file as its argument.

HTH,
- Manish
v jain
Greenhorn

Joined: Jun 16, 2004
Posts: 4
I have tried using

<exec executable="cmd">
<arg file="${tomcat_bin}/shutdown.bat"/>
</exec>
It executes a command prompt but doesn't execute this argument... Actually I have to Start and Stop the server evertime the build finishes and starts..
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50675

"javalearner",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
HanMing Low
Ranch Hand

Joined: Oct 18, 2001
Posts: 196
Hi,

Try



Hope this helps.

Cheers.


Han Ming
 
IntelliJ Java IDE
 
subject: Executing batch file from ANT
 
Threads others viewed
Path Convert tag
Error code _from_ ANT
newbie..... ant-weblogic ...pls help
ant - weblogic
Executing DOS commands through ANT
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture