I got an executable .jar
file which I want to run as a Window service to keep it executing even if I get logged out. I searched and found NSSM. However, after completing configuration, when I started service, it stopped and printed Unexpected status SERVICE-STOPPED in response to start control
. I have just added my path
and startup directory
in the Application
tab, nothing else. Moreover, I am unable to find any log file nssm
may create to check what actually has happened.
NSSM logs messages to the Windows System Event Log. To bring up the Event Viewer, just enter 'event viewer' in the Windows Start menu. Once in the Event Viewer, select Event Viewer (Local)->Windows Logs->Application->nssm or Event Viewer (Local)->Custom Views->Errors & Warnings View.
In addition, make sure you configure log files for stdout and stderr when installing your service using NSSM.
Your NSSM properties for installing an executable jar file should look something like this:
Path: C:\Program Files (x86)\Java\jdk1.7.0_45\bin\javaw.exe
Startup directory: C:\Program Files (x86)\Jars
Arguments: -jar C:\Program Files (x86)\Jars\my_executable.jar