I am using CentOs 7.5.1804 and have a problem with a service. When i start my service with systemctl it fails with the message
which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
Java not found!
Following the error message i did a which java
and it returns
which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
Java not found!
But when i log in to the system as the user app i get a feedback from java java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
Here is a snip of my service located in /etc/systemd/system
[Service]
Type=forking
User=app
Group=app
ExecStart=/opt/div/ui/bin/service.sh -s start -t myserver
ExecStop=/opt/div/ui/bin/service.sh -s stop -t myserver
SuccessExitStatus=143
TimeoutStartSec=0
TimeoutStopSec=240
#install
[Install]
WantedBy=multi-user.target
What do i miss? Any suggestions ?