Java – start a jar file like a service in Linux

I want to start and stop my jar file as follows

Service myservice start

Service myservice stopped

My current jar file runs as follows

cd /home/alex/IdeaProjects/myService
java -jar target/myService-SNAPSHOT-1.jar server config.yml

What should I do?

Solution

You need a service wrapper to run the jar file I wrote a simple package here

For a broader description here

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>