Java program runs in the background

I have a simple java program, which is just one piece of code that reads from the database and modifies the contents of the database based on certain conditions. Now I want this program to start automatically when it starts and to silently work in the background if someone has not killed it from the task manager. I had never done anything like this before and I don’t know exactly how to do it. Can someone help me on how to do this? Thanks..

+6
source share
3 answers

Follow these steps to complete the task: (Assuming you are using windows and jre is installed)

  • First compile your Java program and put the class file in one place.
  • Now create a bat file and put java LOCATION TO THAT CLASS FILE/MyProgram in it.
  • Put your bat file in the launcher
  • Reboot the system, you will get your program in the background ..! Hope this helps you.
+7
source

There are two problems here.

Also for windows you can check out this JSL http://www.roeschter.com/

Thanks.

+1
source

first create a jar bash and then add it to your crontab task list.

-1
source

Source: https://habr.com/ru/post/914949/


All Articles