How to execute *.BAT file from the Java Application

Hello to all.I wants to run *.BAT file form my applicaion.Can u give the code of that two-four line,pleaseWating four your replay.Yours FriendBhavin Shah.....
[200 byte] By [bhavinshah20a] at [2007-9-28 11:29:39]
# 1
HI you can execute the .BAT file from java application by using the Runtime class.below is the sample code.Runtime rt=Runtime.getRuntime();Process pr=null;pr=rt.exec("cmd.exe /c start "+deleteReport+" "+fDest);
vasubaratha at 2007-7-12 2:06:30 > top of Java-index,Archived Forums,Java Programming...
# 2
Hi vasubarathThanks.But I dont understand some of the turm used in the linepr=rt.exec("cmd.exe /c start "+deleteReport+" "+fDest); Bhavin Shah
bhavinshah20a at 2007-7-12 2:06:30 > top of Java-index,Archived Forums,Java Programming...
# 3
pr = rt.exec("cmd.exe /c start " + yourProgramName)The exec() method executes the command you specify in the argument and returns a process. In this example, it's telling Windows to run "yourProgramName".HTH
yawmarka at 2007-7-12 2:06:30 > top of Java-index,Archived Forums,Java Programming...
# 4
Thanks yawmark
bhavinshah20a at 2007-7-12 2:06:30 > top of Java-index,Archived Forums,Java Programming...
# 5
Hello yawmark when i run my prog. , i get following error.CreateProcess: cmd.exe /c start JavaEmailProxy.PIF error=0Press any key to continue . . .What is cmd.exe /c startThanks...
bhavinshah20a at 2007-7-12 2:06:30 > top of Java-index,Archived Forums,Java Programming...
# 6
Cmd.exe is the command interpreter for Windows NT/2000. It looks like you're trying to run a *.PIF file - try running the actual *.BAT file instead.
yawmarka at 2007-7-12 2:06:30 > top of Java-index,Archived Forums,Java Programming...