Angsuman's Java Blog

News and views from my perspective as a Chief Software Architect and CEO. Focused on Java and Web Technologies.


Sunday, April 07, 2002

Runtime.exec in Java Tip
> Amitava Ghosh wrote at caljug:
>
> Dear all,
> I am trying to call an executable(written in C++) inside a java code through a
> batch file(where the parameters for the C++ executable are stored).
> When I am using
> Process p = Runtime.getRunTime().exec("cppexe.bat")
> it is working fine but when I am using start to run the batch process in a new
> window as in
> Process p = Runtime.getRuntime().exec("start cppexe.bat")
> I am getting an IOException Cannot create process etc etc

Angsuman>
start is a command of cmd. So run it instead:
Process p = Runtime.getRuntime().exec("cmd /c start cppexe.bat");