springboot打包jar文件做成windows服务

1.在idea中用maven将程序打成jar,放到运行的目录中。

2.去github上面下载winsw: https://github.com/kohsuke/winsw/releases

springboot打包jar文件做成windows服务_第1张图片

 3. 将WinSW.NET4.exe文件复制到java程序所在文件夹中(修改为要注册的服务的xml配置文件同名)

springboot打包jar文件做成windows服务_第2张图片

4.新建一个xml文件,配置服务注册信息,写入以下内容:



 
 eurekaServer
 
 Eureka服务注册
 
 Spring Cloud Eureka注册中心
 
 java
 
 -jar "eureka-0.0.1-SNAPSHOT.jar"
 
 F:\application
 
 reset

参数说明:https://github.com/kohsuke/winsw/blob/master/doc/xmlConfigFile.md

5.服务安装:使用cmd,用cd命令转到eurekaRegist.exe所在文件夹,然后执行命令
安装服务命令:eurekaRegist.exe install
卸载服务命令:eurekaRegist.exe uninstall

springboot打包jar文件做成windows服务_第3张图片

springboot打包jar文件做成windows服务_第4张图片

springboot打包jar文件做成windows服务_第5张图片

springboot打包jar文件做成windows服务_第6张图片

 

 

你可能感兴趣的:(SpringCloud)