Some time ago, the director proposed to send the data in the database through the interface to the client side. A Java program needs to be registered as a Windows system service to transfer data on a timed basis. Proposed by the Director. NET write a system service, send the data to the customer is a good solution, out of the right. NET knows very little of the frustration, did not choose this solution. Dickens, finally found how to register a Java program as a Windows system service.
Words not much to say, directly on the program:
First, download third-party tools: Windows Service Wrapper (: https://github.com/kohsuke/winsw/relases)
Download WSW:
Second, after downloading the. exe file, you need an. XML configuration file to work with. Note: The file name of the. exe file and the. xml file should be consistent:
How do I configure the Sendmessagetocustomer.xml file? The information is as follows:
1 <Service>2 <!--Unique identification of the service -3 <ID>Sendmessagetocustomer</ID>4 <!--Register as the name of the system service -5 <name>Sendmessagetocustomer</name>6 <!--Description of the service -7 <Description>Send the data to customer</Description>8 <!--to add a Java program to a system service -9 <executable>Java</executable>Ten <!--parameters to execute - One <arguments>-jar "Sendmessagetocustomer.jar"</arguments> A <!--Log Mode - - <LogMode>Rotate</LogMode> - </Service>
Third, the download good WinSW.NET2.exe modified to SendMessageToCustomer.exe. And put the SendMessageToCustomer.exe, Sendmessagetocustomer.xml and the well-played jar package Sendmessagetocustomer.jar in the same directory.
Iv. run cmd with administrator privileges, enter the directory, execute SendMessageToCustomer.exe install, and register the JAR program as a Windows system service. To open the Services page, you can find:
One more Sendmessagetocustomer service in the service, open the service and perform the startup. The service can be executed normally.
Java programs are registered as Windows system Services