Make a object of this class , and then through this object call function within this class, in argument giving the ip address you want to ping. If this ip is reachable it will return true.
I read a lot of stuff recently about writing a ping program in java and I stumbled upon many answers. I tried the approach above but it didn't work (the answer is here: http://java.sun.com/j2se/1.5.0/docs/api/java/net/InetAddress.html#isReachable(int) ). I also tried this one: http://java.sun.com/j2se/1.5.0/docs/guide/nio/example/Ping.java but without success. My last try was with exec, which worked but that's not a very nice platform independent solution. What are my options for writing a program similar to the one above that actually work? Should I write a program in C and use it in java or there are some thrd. party libraries known?