0

How do i make my .jar file execute on startup because we have constant blackouts here and when the server starts up i want the server.jar to start as well.

Is there any simple way of doing this ?

1

Edit the /etc/rc.local file by doing:

sudo nano /etc/rc.local

And in there type

java -jar /path/to/your/file.jar

Make sure this goes BEFORE the 'exit 0'

  • Hi ive done this already, it does not work. – user294159 Jun 26 '14 at 14:00
  • does java -jar /path/to/your/file.jar normally work? – Mitch Jun 26 '14 at 14:07
  • Yes, well the command i use while logged in with putty is nohup java -jar /path/to/file/file.jar & then it works perfectly fine. – user294159 Jun 26 '14 at 14:17
  • Try adding that exact command to the file, and see if that works for you – Mitch Jun 26 '14 at 14:17
  • Also same result doesn't work, because its a basic network app so when i run the command it works but doesn't start up. – user294159 Jun 26 '14 at 14:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.