In one of our projects, we have to call a dos command in java. That seems ok however there is a problem about code. It gives an exception because the remaning program goes without waiting the dos command's completion.
Above code, makes a sort in 1.txt and saves it to 2.txt.. My code goes without waiting the 2.txt to be created and gives an exception like couldn't found 2.txt . Thanks for any help, i hope i could explained clearly what i wanted to ask..Code:
Runtime r = Runtime.getRuntime();
r.exec("cmd /C sort 1.txt /O 2.txt");