Here is an example:
<% @ Page contenttype = "text/html; charset = big5" session = "false" Import = "Java. Io. *" %>
<HTML>
<Head>
<Title> </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = big5">
</Head>
<Body>
<%
Runtime runtime = runtime. getruntime ();
Process = NULL;
String line = NULL;
Inputstream is = NULL;
Inputstreamreader ISR = NULL;
Bufferedreader BR = NULL;
String IP = "add the IP address you want to ping here ";
// Modify the above IP Address
Try
{
Process worker runtime.exe C ("ping" + IP );
Is = process. getinputstream ();
ISR = new inputstreamreader (is );
BR = new bufferedreader (ISR );
Out. println ("<PRE> ");
While (line = Br. Readline ())! = NULL)
{
Out. println (line );
Out. Flush ();
}
Out. println ("</PRE> ");
Is. Close ();
ISR. Close ();
BR. Close ();
}
Catch (ioexception E)
{
Out. println (E );
Runtime. Exit (1 );
}
%>
</Body>
</Html>