把jar包做成windows服务

1.去GitHub下载需要的文件

在这里插入图片描述
2.
在这里插入图片描述
3.
在这里插入图片描述

2.修改xml配置文件和.exe文件

在这里插入图片描述

修改文件名,两个文件的文件名要一致

修改xml文件内容


<!--
 This is an example of a minimal Windows Service Wrapper configuration, which includes only mandatory options.
 
 This configuration file should be placed near the WinSW executable, the name should be the same.
 E.g. for myapp.exe the configuration file name should be myapp.xml
 
 You can find more information about the configuration options here: https://github.com/kohsuke/winsw/blob/master/doc/xmlConfigFile.md
 Full example: https://github.com/kohsuke/winsw/blob/sample-config-file/examples/allOptions.xml
-->
<configuration>
  
  <!-- ID of the service. It should be unique across the Windows system-->
  <id>myapp</id>
  
  <!-- Display name of the service -->
  <name>myappsercive</name>
  
  <!-- Service description -->
  <description>myapp服务</description>
  
   <executable>java</executable>
   
   <!-- Path to the executable, which should be started -->
  <arguments>-jar "D:\test\myapp.jar"</arguments>

</configuration>

id:唯一标识,我设为jar包的名称
name:服务中展示的名字
description:服务描述
executable:java 或 jdk路径
arguments:执行的命令和路径

执行.exe文件

在.exe当前目录中进入cmd ,执行myapp.exe install,服务中就有了

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值