문제

I am using java to call arp -s command and waiting for the process to finish in order to complete function .

String command ="arp -s "+entryIpAddress+" ee-ee-ee-ee-ee-ee-ee";
 Process p=Runtime.getRuntime().exec(command);  
         p.waitFor();

but the calling of this process is taking more than the usual time so, is there a way to increase the performance of this method. i cannot remove the p.waitFor() my next function depend on the added entry.

도움이 되었습니까?

해결책

Your code doesn't show any sign of effort towards allowing the process to complete ever. You are not consuming its output, so its output buffer will soon fill up, blocking further progress.

To make this task easier on yourself, please use the ProcessBuilder.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top