How to Run a Java application jar as a Windows service
Running a Java application is easy. But how to run the same java application as a windows service? Read on to find out.
Introduction
On a Windows operating system, the usual method of running a Java application is via its command line terminal or the Powershell. However, there are some restrictions when running a java application through these terminals. The user with the required rights must be logged on at all times. Also, the terminal must be open and running.
Under many circumstances, this is not desirable. So, often times, some other method of running the application is desirable.
To address these issues, Windows has to capability to run applications as services in the background. Services start up with the system and don't need a user to be logged in. Basically it is similar to a UNIX daemon. Java applications cannot directly be run as a windows service. But thanks to Java service wrappers, it can be easily done. Additionally, additional features like error recovery, log file rollover, restart on failure can also be provided to ensure that the Service runs continuously.
In this blog post, we will take a look on how to run a Java application as a window service.