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.
Asked
Active
Viewed 9,230 times
5
-
1It is indeed a programming question. – skiphoppy Aug 24 '15 at 21:31
1 Answers
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

Charissa Willard
- 146
- 1
- 5
-
Perect !!! even after 8 years it works. Slight change - I've set path to java.exe in my case. great answer – codezoner Feb 10 '23 at 08:22