I\'ve just inherited a java application that needs to be installed as a service on XP and vista. It\'s been about 8 years since I\'ve used windows in any form and I\'ve neve
it's simple as you have to put shortcut in
Windows 7
C:\users\All Users\Start Menu\Programs\Startup
(Admin) or User home directory(%userProfile%)
Windows 10 :
In Run shell:startup
in it's property -> shortcut -> target - > java.exe -jar D:\..\runJar.jar
NOTE: This will run only after you login
With Admin Right
sc create serviceName binpath= "java.exe -jar D:\..\runJar.jar"
Will create windows service
if you get timeout use cmd /c D:\JAVA7~1\jdk1.7.0_51\bin\java.exe -jar d:\jenkins\jenkins.war
but even with this you'll get timeout but in background java.exe will be started. Check in task manager
NOTE: This will run at windows logon start-up(before sign-in, Based on service 'Startup Type
')
Detailed explanation of creating windows service
Exe4j is a very good option although it is not free. Check it out at Exe4j In the wizard to create the .exe file, you are give the option to create a service.
A simple way is the NSSM Wrapper Wrapper (see my blog entry).
I think the Java Service Wrapper works well. Note that there are three ways to integrate your application. It sounds like option 1 will work best for you given that you don't want to change the code. The configuration file can get a little crazy, but just remember that (for option 1) the program you're starting and for which you'll be specifying arguments, is their helper program, which will then start your program. They have an example configuration file for this.
Use "winsw" which was written for Glassfish v3 but works well with Java programs in general.
Require .NET runtime installed.
Another good option is FireDaemon. It's used by some big shops like NASA, IBM, etc; see their web site for a full list.