Hi,
I have asked this question before. I am having the folowing requiremet.
- Run the batch file.
- Give some time to run the batch file. 3.Close the batch file
i have the following code that does not meet the requirement. Please tell me where i have made mistake
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
//pr.exitValue();
//wait(10000);
pr.waitFor();
pr.destroy();
I have used the waitFor that doesnot work.how can i give delay for about 15 minutes after executing the batch file
Thanks
-
A suggestion: grab the output and error streams and see what they are printing out. You may see that there is an error happening with the batch file making it return sooner than you expect.
-
I'm not sure what you want, but with
Thread.sleep(900000);
you can wait for 15 minutes.
-
If you do not have threads reading the stdIO from the batch process, the batch process can block. Even if you are not interested you still ned to read it and discard it. Then your wait for has a better change of working.
0 comments:
Post a Comment