Have you tried the waitFor method in the Process class?
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
OK. I'm all Windows here, so I can't check out any Unix situations. All I can do is wish you good luck, so "Good Luck!"
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
Does anyone know how to make the program wait for this command to complete before it moves onto the next lines of code?
Try removing the first two arguments from your string array i.e.
final String[] args = { "sudo cp", "/source/*", "/target" };
And preferably use ProcessBuilder class for running external processes.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734