https://www.cnblogs.com/xinglongbing521/p/11157742.html
1.把java程序打包为jar包
2.下载winsw
3.创建项目(scoprio)scorpio.xml
<service>
<id>scorpio.jar</id>
<name>scorpio.jar</name>
<description>scorpio.jar</description>
<executable>java</executable>
<arguments>-Xmx2560m -jar "D:\winPackage\scorpio.jar" --spring.profiles.active=prod</arguments>
<logpath>E:\logs</logpath>
<logmode>roll</logmode>
</service>
tip:
<!-- 开机启动 -->
<startmode>Automatic</startmode>
4.以超级管理员运行cmd,不然会报权限不足错误
安装服务:MyApp.exe install
卸载服务:MyApp.exe uninstall
检查状态:MyApp.exe status
启动服务:MyApp.exe start或net start MyApp
停止服务:MyApp.exe stop或net stop MyApp
重启服务:MyApp.exe restart
5.如果项目还需要其他附属文件,比如key文件夹,比如外部属性文件,可以放到同一目录
原文地址:https://www.cnblogs.com/brxHqs/p/11684059.html
时间: 2024-10-30 04:34:37