Alex Rivera | Logout

How do I run command line from Java code in the background?

Asked 2012-07-09T11:46:13.470
8

I have the following line to run a batch file,

Process process = Runtime.getRuntime().exec("cmd /c start rake.bat");

But I want it to run in the background and not display the command line to the user. How can I change it to do this?

The problem is that the command window opens and intrupts the programs GUI. I just want the command window to not be visible while it is executing the batch file.

Edit
Report

1 Answer

0
Process process = Runtime.getRuntime().exec("cmd /c start rake.bat");

If you are calling the above line from a java process to execute the batch file. This will by default run in background.

answered 2012-07-09T11:49:49.463

Your Answer