javalinuxsocketsubuntuinit

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.

Solution

  • 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