Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when trying to run an executable .jar as a Windows service using NSSM

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.

like image 753
aneela Avatar asked Oct 23 '14 04:10

aneela


People also ask

Can't open service Openservice (): Access is denied Nssm?

Resolution: Create local user. Ensure local user has rights to run as a service (https://learn.microsoft.com/en-us/system-center/scsm/enable-service-log-on-sm?view=sc-sm-2019) - Local Group Policy. Have the nssm.exe ALSO accessible by the created user.


1 Answers

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

like image 113
Charissa Willard Avatar answered Oct 21 '22 08:10

Charissa Willard