Windos下 java后台软件服务化(举例)-WinSW
WinSW-软件服务化
1.1 举例:ApiWintool可执行jar
ApiWintool.exe
ApiWintool.jar
ApiWintool.xml
install.cmd
uninstall.cmd
1.2 举例:ApiWintool.xml
<service>
<!--windows服务id 必须唯一 -->
<id>ApiWintool</id>
<!-- windows服务名称-->
<name>ApiWintool</name>
<!-- 描述 -->
<description>自研发的后台</description>
<!-- 启动的可执行文件 %BASE%为当前demo.exe所在路径-->
<executable>C:\Program Files\Java\jdk1.8.0_192\jre\bin\java.exe</executable>
<!-- 传递给可执行文件的参数-->
<arguments> -jar "%BASE%\ApiWintool.jar"</arguments>
<!--日志模式 -->
<logmode>rotate</logmode>
<!-- 日志文件路径-->
<logpath>%BASE%/logs</logpath>
<!-- 开机自启 -->
<startmode>Automatic</startmode>
</service>
1.3 ApiWintool的install.cmd
@echo.InstallService......
@echo off
@ApiWintool install
@ApiWintool start
@echo off
@echo.Success!
1.4 ApiWintool的uninstall.cmd
@echo.UnInstallService
@echo off
@ApiWintool stop
@ApiWintool uninstall
@echo off
@echo.DeleteSuccess!
为梦想不止不休!