How can i auto-restart the runnable jar file in Linux.
I am running jar in linux VPS in a separate screen but it stops after some time due to OUTOFMEMORYERROR Java heap space.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Write a simple launcher which will restart the application once it came down. Something like this:
Just to be sure that the VM comes done correcly, you might want to consider the following around your main loop:
Edit: I’ve personally succesfully used the Java Service Wrapper for restarting a now and then failing apache tomcat which suffered from memory leaks after applications have been redeployed too much. You might want to take a look at it, it’s pretty straight forward.