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