1.去GitHub下載需要的文件
2.
3.
2.修改xml配置文件和.exe文件
修改文件名,兩個文件的文件名要一致
修改xml文件內容
<!--
This is an example of a minimal Windows Service Wrapper configuration, which includes only mandatory options.
This configuration file should be placed near the WinSW executable, the name should be the same.
E.g. for myapp.exe the configuration file name should be myapp.xml
You can find more information about the configuration options here: https://github.com/kohsuke/winsw/blob/master/doc/xmlConfigFile.md
Full example: https://github.com/kohsuke/winsw/blob/sample-config-file/examples/allOptions.xml
-->
<configuration>
<!-- ID of the service. It should be unique across the Windows system-->
<id>myapp</id>
<!-- Display name of the service -->
<name>myappsercive</name>
<!-- Service description -->
<description>myapp服務</description>
<executable>java</executable>
<!-- Path to the executable, which should be started -->
<arguments>-jar "D:\test\myapp.jar"</arguments>
</configuration>
id:唯一標識,我設爲jar包的名稱
name:服務中展示的名字
description:服務描述
executable:java 或 jdk路徑
arguments:執行的命令和路徑
執行.exe文件
在.exe當前目錄中進入cmd ,執行myapp.exe install
,服務中就有了