0

Is there a command to make it. I'm trying to run a .jar file with linux boot and make it run all the time.

1 Answers1

2

Create a file in /lib/systemd/system. Its name must end with .service. For example myfirst.service.

Find the full absolute path to java using which java In the file put the following.

[Unit]
Description=Job that runs the foo.jar

[Service] ExecStart=/full/path/to/java -jar /full/path/to/.jar

[Install] WantedBy=multi-user.target

Enable it to run at boot:

sudo systemctl enable myfirst

Also refer to this answer for further clarification

A.Sha
  • 576
  • 3
  • 13