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.
Asked
Active
Viewed 623 times
1 Answers
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
- 616