Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Java application on startup of Ubuntu Linux

I have a requirement where I need to develop application that reads TCP/IP Socket. I successfully made the program as Java program with No GUI means as soon as program runs it starts listening to the Socket and gets the response with the help of Netbeans IDE. Now as per my requirement i have to start execution of this program as soon as Linux system Booted.

Actually I am very novice in Java and Linux Platform, so have few doubts..

  1. Is my Socket Program with no GUI is fine to be run as per my requirement.
  2. How can I write script to run jar on Linux Boot up, I got to know. init.d is meant for this.
like image 622
Ram Avatar asked Dec 26 '22 11:12

Ram


1 Answers

Ideally you should create a service wrapper for your java application and then make this service run on startup example here.

Use
sudo update-rc.d mytestserv defaults to run your service wrapper on startup on Ubuntu

like image 96
PbxMan Avatar answered Dec 28 '22 00:12

PbxMan