Windows system configures jar package to start automatically

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 Insert image description here64-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.
Insert image description here
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>

Glossary

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
Insert image description here

#安装服务
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

Insert image description here

You can also view it in the service
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_52796198/article/details/132580922