Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top