Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get a .jar file to run at startup on an Ubuntu machine, but I'm not getting anywhere. I've tried the instructions here , and I've tried using info from the Upstart site & cookbook, but they haven't worked. I've tried both the old SysV and the new Upstart approaches, but neither of them start the .jar on system startup.

Here is the shell script which runs the .jar


java -jar TransformationServer.jar

The file for the SysV startup approach

# Transformation Server
# Description: Transforms incoming messages on a given port and forwards them

case $1 in
        /bin/bash /usr/local/bin/
        /bin/bash /usr/local/bin/
        /bin/bash /usr/local/bin/
        /bin/bash /usr/local/bin/
exit 0

UpStart approach

# transformationserver - transforms incoming http messages, and redirects them
# This service intercepts incoming http messages on a given port, and
# transforms them into an acceptable format in order to be received
# by a 3rd party service

start on runlevel [345]
stop on runlevel [!2345]


    exec /bin/bash /home/ubuntu/TransformationServer/
    # Also trying the below as well
    #exec /bin/java -jar /home/ubuntu/TransformationServer/TransformationServer.jar

Can someone with more experience in using either of these approaches look over my files here, and potentially point me in the right direction with this? This service is needed so our companies system can successfully receive communications from one of our clients.

Thanks in advance.

share|improve this question

How about you use the crontab?

As the user you want the jar to run as, run this:

crontab -e

Add the line:

@reboot /path/to/your/

Save it. That will make it so when the server comes back up after a reboot, it will run your shell script.

This is your crontab, you can learn all about it with man crontab, or the Wikipedia page:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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