Search code examples
javascheduled-taskswindows-servertaskscheduler

Java batch application keep running behind even if it is ended in task scheduler


Java batch application keep running behind even if it is ended in task scheduler. Task scheduler shows Ready status and application behind still not getting stopped.


Solution

  • If I understand your setup correctly, you have a windows .bat file, from which you run java application (command like java -jar myapp.jar) and that .bat file is started and stopped by windows task scheduler.

    My guess is, that when .bat file is started it invokes java app (as expected), but when you kill it, only thing that gets killed is the .bat "container", not the actual app. And since the scheduler is linked with .bat file and it is not running anymore, it shows that the program is stopped (because it is. The "container script" itself is not running anymore) and the stop signal does not propagate to the java application (or it just ignores it)

    Can't you set task scheduler to run java app directly? That would definitely help