Ping remote UNIX machine from a java application

Hi Friends,

Can some one please guide me on how to make a script run on a remote UNIX machine from a java application.
Or may if you can just tell me how do u ping to the remote UNIX machine using java code.

Been looking for the solution since 5-6 hrs, didn't got any where near :frowning:

Thanks.

If you want to do it without using JNI , you can do the following

String host = "XXX.XXX.XXX.XXX";            // host you want to reach
int timeOut = 3000;                         // 3 secs

boolean status = InetAddress.getByName(host).isReachable(timeOut);