Java programs are registered as Windows system Services

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.