sudo apt install openjdk-17-jdk -yOracle Java official installers here.
which java
/usr/bin/javaWe use this path when configure systemd file.
sudo nano /etc/systemd/system/your_project_name.service
[Unit]
Description=Webserver daemon
[Service]
ExecStart=/usr/bin/java -jar /home/user/your_project_name/your_project_name.jar --spring.profiles.active=production --spring.config.location=/home/user/your_project_name/application.properties
User=user
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reloadReload the systemd manager configuration. This will rerun all generators (see systemd.generator(7)), reload all unit files, and recreate the entire dependency tree. While the daemon is being reloaded, all sockets systemd listens on behalf of user configuration will stay accessible.
sudo systemctl start your_project_name.service
sudo systemctl enable your_project_name.service