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