Hi, I need the program for to execute the ping...I used like this Iam not getting the output in console.....
<CODE> try{ Process p = null; Runtime run = Runtime.getRuntime(); p = run.exec("ping 168.94.112.203"); }catch(Exception e) { }</CODE>
I have loop of ip address,each time I need to find out whether the system is working /not...Can any one help me please the same. Thanks & Regards, Sridhar.R
The output won't be written to the console. It's written to the output stream of the process. You can get this using the Process.getOutputStream method. You can then read the response from this stream and do with it whatever you want.
Never use Runtime.getRuntime().execute() without reading the classic article by Michael Daconta; do a google search for "when Runtime.exec() won't". Also find out about the ProcessBuilder class in Java 5+.