实验环境:windows server2008R2 、windows10
一、下载winws.exe和winws.xml
下载地址:https://github.com/kohsuke/winsw/releases
下载红色处:

把exe文件、xml文件以及要打包成服务的jar包使用同名,方便管理

二、编辑auth-admin配置文件:
<configuration>
<!-- ID of the service. It should be unique accross the Windows system-->
<id>auth-admin</id>
<!-- Display name of the service -->
<name>auth-admin</name>
<!-- Service description -->
<description>统一支撑平台</description>
<executable>java</executable>
<arguments>-jar auth-admin.jar</arguments>
</configuration>
三、cmd命令行进入当前目录
打包成服务:
auth-admin.exe install
卸载服务:
auth-admin.exe uninstall
启动服务:
auth-admin.exe start
关闭服务:
auth-admin.exe stop
重启服务:
auth-admin.exe restart
查看状态:
auth-admin.exe status
脚本启动:
cd C:\Users\Administrator\Desktop\service\auth-admin
auth-admin.exe stop
auth-admin.exe uninstall
auth-admin.exe install
auth-admin.exe start
本文详细介绍如何使用winsw在Windows环境下将Java应用封装为系统服务,包括下载winsw工具、配置服务参数、安装与管理服务的步骤。
1325





