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文件夹,比如外部属性文件,可以放到同一目录

 

 

相关文章:

  • 2021-07-02
  • 2021-08-02
  • 2021-11-18
  • 2021-12-22
  • 2021-04-05
  • 2022-12-23
  • 2021-10-25
猜你喜欢
  • 2021-11-05
  • 2021-08-22
  • 2021-11-08
  • 2022-12-23
  • 2021-04-29
  • 2021-06-04
  • 2022-12-23
相关资源
相似解决方案