Java Process is not getting killed when its Windows service is stopped

Sarika Singh 1 Reputation point


I have created a Windows Service for a Java based application which is deployed in Tomcat in a Windows 10 machine using below article:


Command I used to create a Windows service is
"C:\Program Files (x86)\Windows Resource Kits\Tools\Instsrv.exe" apache "C:\Program Files (x86)\Windows Resource Kits\Tools\Srvany.exe"

I did required registry configuration changes also for this windows service.

But when I stopped this service then that Java process in Task Manager is not getting killed and even if service is stopped, application keeps running.

Can you please help on this issue that why Java process is not getting killed?

Sarika Singh

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
5,942 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
8,174 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. EckiS 806 Reputation points

    when you are calling a batch file to start the Java process, this will not work:
    Q&A: Why doesn’t Srvany Close my Application when I Stop the Service?

    No comments

  2. MotoX80 23,491 Reputation points

    Use NSSM instead of srvany.

    It will terminate the launched process when you stop the service.