xxlJob等流行开源框架学习需要经常性启动jar,本文提供一种偷懒方式
1.从github上下载一个开源exe应用
查看本人另外一篇博文:windows应用启动java -jar_haohaounique的博客-CSDN博客_windows系统启动jar
2.修改一下xml配置如图(修改成你自己打的jar的名称)
<service>
<!-- ID of the service. It should be unique across the Windows system -->
<id>xxljobadmin</id>
<!-- Display name of the service -->
<name>xxljobadmin</name>
<!-- Service description -->
<description>This service is a service created from a minimal configuration</description>
<!-- Path to the executable, which should be started -->
<executable>java</executable>
<arguments>-jar %BASE%\xxljobadmin.jar --server.port=8083</arguments>
<logpath>%BASE%\logs</logpath>
</service>
3.改路径文件夹,输入cmd 回车进入dos窗口
4.命令安装 xxljobadmin.exe install
C:\Users\haoha\Desktop\启动配置>xxljobadmin.exe install
2022-05-04 12:48:02,417 INFO - Installing service 'xxljobadmin (xxljobadmin)'...
2022-05-04 12:48:02,426 INFO - Service 'xxljobadmin (xxljobadmin)' was installed successfully.
5.win+R 看看,输入services.msc 右键可启停
6.卸载
C:\Users\haoha\Desktop\启动配置>xxljobadmin.exe uninstall
2022-05-04 12:49:50,122 INFO - Uninstalling service 'xxljobadmin (xxljobadmin)'...
2022-05-04 12:49:50,128 INFO - Service 'xxljobadmin (xxljobadmin)' was uninstalled successfully.
右键可以启停,随windows开关机来启动了
最后可以有方式的懒一下,下次就不用考虑有没有启动了(需要注意,后续端口不能冲突,tomcat应用,你懂的)