It is relatively easy with Java Service Wrapper
. It is described with JBoss example at http://wrapper.tanukisoftware.org/doc/english/integrate-simple-win.html
. But actually it is even easier, so I'll try to describe it here.
Let's assume there is some ready application with public static void main method in my.company.Application class.
First, you will need to download Wrapper from here
. Unpack it to some folder, better in C:/ or some short folder, I had some problems with running it from deep folder hierarchy.
Second, you will need to update configuration file at "conf/wrapper.conf". Actually, it is quite long (mostly because of comments), but worth checking as it contains mostly necessary information. You will have to update:
# path to java
# this is service launcher, leave it as is
# jars related to wrapper
# all jars related to your application
# your application class that contains main method
# all parameters, when needed
Update other parameters if needed, but better at least check them. There is valuable and handy stuff like service name and description.
Third, run bin/InstallTestWrapper-NT.bat.
You service is installed and ready. You can start it from Administrative tools or with bin/StartTestWrapper-NT.bat.