I was calling a bat file from java which contains the executing command of a file.

ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/k","start test.bat");
Process p = builder.start();

I want to terminate this process after 3s. What's the way of setting time of execution for this process?

0 Answers