Ubuntu: Making a service from the project


Hi I have a java server(it listens) which runs when I do: ant compile jar run in the terminal

What I want to do is sudo service myproject start so that I won't have to be in terminal(when I do ctrl+c in terminal or close the terminal the program stops which I don't want)

How can I do that?


One approach would be to nohup the command. This allows you to close the terminal and even log out while the program continues to run.

nohup ant compile jar run &  

This doesn't create a proper 'service' but it does what you are looking for.


Use Apache Commons Daemon and JSVC: http://commons.apache.org/proper/commons-daemon/

It is the solution which is also used by the most common Java daemon: Apache Tomcat.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »