winsw将Jar包作为windows服务(WinSW.zip)

时间:2022-08-27 10:30:19
【文件属性】:
文件名称:winsw将Jar包作为windows服务(WinSW.zip)
文件大小:143KB
文件格式:ZIP
更新时间:2022-08-27 10:30:19
jar包设置服务 将springboot部署的jar包作为windows服务,实现开机自动启动
1、将打包好的jar包重命名,将版本号去掉 如 xxxxxx-1.0.0.jar 重命名为 xxxxxx.jar
2、将下载好的WinSW.NET4.exe文件放置xxxxxx.jar同一路径下,并将其 重命名为 xxxxxx.exe (与jar名称一致)
3、下载sample-minimal.xml至同一路径,并将其 重命名为 xxxxxx.xml (与jar名称一致)
4、xxxxxx.xml文件,修改配置如下

<!-- ID of the service. It should be unique accross the Windows system-->
xxxxxx
<!-- Display name of the service -->
xxxxxx Service (powered by WinSW)
<!-- Service description -->
This service is a service cratead from a minimal configuration
<!-- Path to the executable, which should be started -->
java
-jar "xxxxxx.jar"


5、至此所有配置已完成,在此目录下以管理员身份执行cmd 命令为 AllInOne.exe install,在windows服务可见我们的jar包已经被作为了windows服务。
PS: 替换新包步骤:1、将服务停止,更换新包(重命名包名) 2、启动服务
卸载服务步骤: 1、停止服务 2、管理员身份执行cmd 命令为 xxxxxx.exe uninstall
相关文件请放置固定位置,以防他人误删
重要提示 作为windows服务后启动,无法查看控制台,请将完善项目中的log输出日志文件配置。
【文件预览】:
sample-minimal.xml
WinSW.NET4.exe

网友评论