Hello I am running a kubuntu 13.10 distro, but I guess my question is pretty general...how to make a .jar execute in background at system start?


You can put your command in file /etc/rc.local:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

java -jar file.jar &

exit 0
  • Instead of exiting 0, would it be better to exit with $? – spuder Apr 8 '14 at 16:47
  • will it run as a background task this way? Or do I need to explicitely set a "&" after the command? – Phate Apr 8 '14 at 19:18
  • Adding & to your command to make it running in background. – cuonglm Apr 8 '14 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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