6

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.

1
  • 1
    It is indeed a programming question.
    – skiphoppy
    Commented Aug 24, 2015 at 21:31

1 Answer 1

10

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

1
  • Perect !!! even after 8 years it works. Slight change - I've set path to java.exe in my case. great answer
    – codezoner
    Commented Feb 10, 2023 at 8:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.