aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes executing a .bat file through ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "executing a .bat file through ANT" Watch "executing a .bat file through ANT" New topic
Author

executing a .bat file through ANT

L Brennan
Greenhorn

Joined: Apr 15, 2003
Posts: 23
I am trying to execute a .bat file through ANT.
The contents of the .bat file are as follows:
cd \oc4j\j2ee\home
java -jar admin.jar ormi://localhost admin admin -shutdown

I am using the exec task of ant as follows:
exec executable="C:\ocj4\j2ee\home\stoporion.bat"
(I have left out the brackets!). I am getting the following error:
file:C:/ant/apache-ant-1.5.3-1/bin/build.xml:61: Execute failed: java.io.IOExcep
tion: CreateProcess: C:\ocj4\j2ee\home\stoporion.bat error=3
Does anyone know how to execute a .bat file on its own. I don't need to pass arguments or anything like that. I just want to have the contents of the .bat file executed itself?
Thanks again for any help!
L Brennan
Greenhorn

Joined: Apr 15, 2003
Posts: 23
Twigged it eventually. Now using:
exec dir="C:\oc4j\j2ee\home" executable="C:\oc4j\j2ee\home\stoporion.bat"
[ April 25, 2003: Message edited by: L Brennan ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: executing a .bat file through ANT