Java programs configured as Windows system services

Source: Internet
Author: User

Two-Step execution:

The first step: Java into a jar package, and use exe4j to play EXE package

Exe4j is very useful, it needs to be explained that there are 32-bit and 64-bit system differences. The following is a successful 64-bit configuration of the exe4j file, the EXE does not contain the JRE, slightly larger than the jar package. Requires the server to have a Java environment.

Success_64.exe4j
2.0 KB

1. Select jar in EXE mode

2. Fill in the application name and output path

3. Select Console application, and fill in the generated EXE name

4. First click on the + sign to import the jar package, in the browse, select the class to execute when the app starts

5. Fill in the supported JRE version. Fill 1.6

6. The next step is complete.

Step two: Use the Srvany.exe tool to configure EXE as a system service

Installing INSTSRV db-server F:\Desktop\jar2exe\srvany.exe   

(Db-server is the name of the service you define yourself, which can be the application that you want to start as a system service.) )

After the installation, we need to configure the Srvany.exe so that we can load the program we specified, and configure the method, start-run-regedit, open the registry, and navigate to the following path. Hkey_local_machine\system\currentcontrolset\services\db-server
If the service name does not have a parameters project, right-click the new item on the service names project, name parameters, and then navigate to the parameters item to create a new string value for the following.

The name application value is the address of the program that you want to run as a service.
The name Appdirectory value is the folder path of the program that you want to run as a service.
The name appparameters value is the parameter you need to start the program that you want to run as a service.

Reference: http://www.cnblogs.com/codealone/p/3156943.html

Srvany.rar
20.3 KB

A few quick scripts to do the above:

Intall.bat
bytes

Run-del.bat
bytes

Run-install.bat
1.0 KB

Uninstall.bat
bytes

Java programs configured 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.