Issue
I have a Java application packaged as runnable JAR which I need to install on end users Windows machines.
The application must be resilient and unobtrusive, I could only provide a link for the users, and they would expect to download and install it(the Windows way, like with NSIS). After installation it should run automatically as Windows Service, which must be autoconfigured to restart on failure.
I investigated these wrapper frameworks:
- Yet Another Java Service Wrapper(YAJSW) - Tried it, but it seems to require access to the target systems in order to configure and install the service(run my JAR and check its PID, then run genConfig.bat, then modify the config script and finally install as service).
- Tanuki's Java Service Wrapper(JSW) - Similar to YAJSW?
- Apache Commons Daemon - Haven't tried it
- Launch4j - Used by YAJSW "for generating wrapper.exe on windows"?
- Non-Sucking Service Manager(NSSM) - Just found this one
Does any one of them support my scenario, or could be integrated with install system to complete it?
If there is no way to achieve this, I could fallback to these options:
- Rewrite the application with .NET or C(Windows API) which have native integration with the services facility.
- Provide the runnable JAR for download and tell the users to put it in the Startup folder(similar effect).
What would you suggest?
Solution
I just wrapped the JAR into a Windows executable with Launch4j's Maven plugin.
Then the executable was distributed to the end users to their Windows Startup folders, and when combined with Launch4j's option to auto-restart on crash removed the need to run the program as Windows Service.
Answered By - kvhadzhiev
Answer Checked By - Marilyn (JavaFixing Volunteer)