By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,646 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,646 IT Pros & Developers. It's quick & easy.

waitFor() not working properly

P: 2
Im working in a project that need to delete a directory on client disk and copy a folder (with everything inside) over the network from my disk to the client disk. After that (when the transfer is finished) it must run a specific JAR.
I'm using Runtime.getRuntime().exec() to execute a bat file that performs the transfer, and a .exec() that runs the jar in a command line.
I can run the two tasks separately, but when I run them in sequence using a waitFor() between then (so the second task will execute only when the first one finishes) it does not work, the two programs open almost instantly.

Its something like this:

Process exec;
packeado = "cmd.exe /C start java project....";

exec = Runtime.getRuntime().exec("cmd.exe /C start C:\\transfer.bat");
exec = Runtime.getRuntime().exec(packeado, null, new File("C:\\Project"));
Apr 17 '12 #1
Share this Question
Share on Google+
2 Replies

P: 13,264

P: 2
I already have read that article. Beside that, is there any way to make the program run, perhaps in a different way but doing the same?

Apr 18 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.