Table of contents
1. Download WinSW.NET4.exe
After downloading https://github.com/winsw/winsw/releases
, rename it to the jar name, which is the project .exe. For 64-bit systems, select net4, and for 86-bit systems, select net2.
2. Create the directory structure of windows
For example, I use the test path of the d drive.
After changing the downloaded exe name, create the project name.xml. Note that the directory cannot be in Chinese.
3. Write xml configuration file
<service>
<id>mengshi</id>
<name>mengshi</name>
<description>erp</description>
<env name="JAVA_HOME" value="%JAVA_HOME%"/>
<executable>java</executable>
<arguments>-jar "D:\test\mengshiERP-9083-2.21.jar"</arguments>
<startmode>Automatic</startmode>
</service>
4. Check the environment
4.1 Whether to install jdk
4.2 Is there a .net framework4 service?
5. Installation
Enter the test directory in administrator mode
#安装服务
mengshiERP-9083-2.21.exe install
#启动服务(管理员模式,方法1)
net start mengshi
#启动服务(方法2)
mengshiERP-9083-2.21.exe stop
#卸载服务
mengshiERP-9083-2.21.exe uninstall
#关闭服务(管理员模式,方法1)
net stop mengshi
#关闭服务(方法2)
mengshiERP-9083-2.21.exe stop
#重启服务
mengshiERP-9083-2.21.exe restart
#服务状态
mengshiERP-9083-2.21.exe status
You can also view it in the service