I have a jar executable that I'm trying to run until stop on a linux server. I've tried looking at the Java Service Wrapper API, but it was really difficult and I'm not even sure that's what I want. Is there a way I can run a program on the server so that when I log off the program keeps running? I'm using ssh to login to the server and commandline to run the jar. Thanks!
Run:
nohup java -jar myjar.jar &
The ampersand at the end will run it in a new forked process, so it will continue after you log out. nohup
prevents it from hanging up when its owner logs out.
If you have the ability to set the Server as a Daemon you can do so. If not you can try to use a programm like screen to create a virtual Terminal.
sudo apt-get install screen
screen java -jar myJar.jar
if you want to reatach your terminal:
screen -r
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With