How to start Java Jar as Service on Linux

0 min read 68 words

If you have a Java Jar file, you can run it as a service under Linux/Ubuntu.

sudo ln -s /var/www/japi-0.0.1-SNAPSHOT.jar /etc/init.d/japi

Now you can use the default init.d verbs [start,stop,restart,status].

Additionally, init.d also gives the following.

Usage for your new init.d service

Usage: /etc/init.d/japi {start|stop|force-stop|restart|force-reload|status|run}

Start Java Service

sudo /etc/init.d/japi start

Stop Java Service

sudo /etc/init.d/japi stop

Restart Java Service

sudo /etc/init.d/japi restart

Status Information

sudo /etc/init.d/japi status
Tags:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags