Following tools can be used to install Jar file as a windows service this helps when we have to execute multiple jar files as running jar as windows service helps us to start/stop specific jar file rather than stopping and starting all the jar file process.
Suppose the Jenkins or any other jar or war file which needs to be executed is at location c:/jar/Jenkins.war
- Got to the command prompt at the location where nssm.exe is present example :- E:\download\nssm-2.24>nssm.exe
- Than execute below command as per your locations and parameters required :-E:\download\nssm-2.24>nssm.exe install “JENKINS SERVICE” “C:\Program Files\Java\jdk1.8.0_152\bin\exe” “-jar E:\download\jenkins.war”
Service “JENKINS SERVICE” installed successfully!
- Once all the location and parameters are ok it should start the Jenkins service successfully and it should be reflected under the window’s service panel
- To edit the installed service we can execute below command
It will open a respective edit window under which we can do require changes and hit on edit service option that will update the service accordingly