I am executing an .exe-file from java, using the ProcessBuilder class and the Process class. To explain what I am doing:
builder = new ProcessBuilder(comman
Your current execution thread will be blocked on process.waitFor()
until process is terminated (i.e. execution finished).
Source here
Also note that if process is already terminated : waitFor() will not be blocked. I don't know if the code you put in your question is exactly what you run... but you must be careful and re-create a new instance of Process for every execution of your script (i.e. not just calling start multiple times on the same Process: it won't work after first execution)