Hi,
I am facing one problem while registering my jar application as windows
service using Procrun.
I hava a main class and a TimerTask class. I am initiating TimerTask from
main class as below.
public class mainClass{
public static void main(String[] args){
if ("start".equals(args[0])) start();
if ("stop".equals(args[0])) stop();
}
public void start(){
mTimer=new Timer();
timer.schedule(new myTimerTaskClass(),60000);
}
public void stop(){
mTimer.cancel();
}
}
public class myTimerTaskClass(){
public void run(){
System.out.println("Here repeats the timer");
}
}
I deploy this jar as windows service using procrun. Registration goes fine
without any error. But when i try to start the service, it gives me error
saying, this service started but stopped immediately since it has no tasks
to execute. It is observed that, it calls start() method in main class but
somehow does not start the TimerTask thread and hence the error.
Please help.
Regards,
Megha