Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

thread to shut the tomcat and restart

THIS IS WHAT I AM TRYING TO DO BUT AFTER STARTING THE TOMCAT MY THREAD IS NOT WAKING UP

HELP PLEASE

class Restarts extends Thread{
String fileStart="",fileRestart="";
String line,line1;
public Restarts(String start1, String restart1){
fileStart=start1;
fileRestart=restart1;
start();
}
public void run(){
try{
Process p = Runtime.getRuntime().exec(fileStart);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
sleep(20000);
Process p1 = Runtime.getRuntime().exec(fileRestart);
BufferedReader input1 = new BufferedReader(new InputStreamReader(p1.getInputStream()));

while ((line1 = input1.readLine()) != null) {
System.out.println(line1);
}
input1.close();

}
catch(Exception e){
e.printStackTrace();
}
}

}

class Restart
{
public static void main(String a[]){
Restarts start = new Restarts("startup.bat","shutdown.bat");

}
}
[1126 byte] By [suneel mekala] at [2007-11-11 7:37:15]
# 1 Re: thread to shut the tomcat and restart
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
aniseed at 2007-11-11 22:37:50 >