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
,服务中就有了