I am trying to execute a batch file which in turn executes an exe and writes output to a file, through java. I do not know why but the output file is not always written. Sometimes the program terminates without writing the file and sometimes it does. Any suggestions? Is there anyway i can wait till the execution of the batch file is complete?Will be great if somebody can help!thanks.