Hi All,
I want to run another
java class file by using threads for every 10 minutes.For that I wrote a code like the Below.but I able to run that programme for only one time.How can I run that class for every 10 mins.
public static void main(
String args[])throws Exception{
Thread t=new Thread();
Process p = Runtime.getRuntime().exec(new String("java Hello"));
InputStream pin = p.getInputStream();//stdout of created process
OutputStream pou = p.getOutputStream();//stdin of process
InputStream pes = p.getErrorStream();//stderr of process
while(true){
try{
p.exitValue(); //throes exception if process is running
break;
}catch(IllegalThreadStateException its){
byte b[] = new byte[1000];
int nob;
nob = pin.read(b,0,1000);
t.start();
for(int i =0;i<nob;i++)
System.out.print((char)b[i]);
t.sleep(1000);}}}
Please Help Me in This Regard.THANKS IN ADVANCE..
-RAVI KUMAR