Amara Amara - 5 months ago 22
Java Question

How do I run a batch file from my Java Application?

In my Java application I want to run a batch file that calls "

scons -Q implicit-deps-changed build\file_load_type export\file_load_type
"

It seems that I can't even get my batch file to execute. I'm out of ideas.

This is what I have in Java:

Runtime.getRuntime().exec("build.bat", null, new File("."));


Previously I had a python Sconscript file that I wanted to run but since that didn't work I decided I would call the script via a batch file but that method has not been successful as of yet.

Answer
Runtime.getRuntime().exec("cmd /c start build.bat");
Comments