1.下载jar包
https://github.com/kohsuke/winsw
2.重命名
3. 编辑xml文件
<configuration>
<id>MyApp</id>
<name>MyApp</name>
<description>This is MyApp.</description>
<executable>java</executable>
<arguments>-jar C:\Users\tanhw119214\Desktop\MyApp\MyApp.jar</arguments>
<!-- 开机启动 -->
<startmode>Automatic</startmode>
<logpath>C:\Users\tanhw119214\Desktop\MyApp\logs</logpath>
<log mode="roll-by-time">
<pattern>yyyyMMdd</pattern>
</log>
</configuration>
4.启动
MyApp.exe install
启动命令
net start MyApp
停止命令
net stop MyApp
卸载命令
sc delete MyApp``
5.验证
win+R 输入 services.msc 即可查看