Debian services misbehaving with JVM

Started by DrFier, November 28, 2022, 12:43:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DrFier

I'm setting up a service on Debian to run a Java application and have a simple script I always used to start it.  Running the script starts the application fine, but the instant I try to start it from the service:
start.sh: Line 3: java: command not found.
My initial thought was that perhaps the env vars were getting reset, but setting them in the service doesn't fix the issue.  I know I can just use the full path to java to launch it but I would like to save myself the trouble of having to update the info on each app separately if it can be avoided.
Ons and Offs
Ideas
The Doctor is out.


Screen images simulated. Not an actual physician. Professional driver on a closed course, do not attempt. If you have an erection lasting more than four hours, contact your significant other.

stormwyrm

Probably better to figure out how to start it using systemd. Compatibility with the old System V initscripts has become spotty and is getting spottier over time as systemd takes on more and more duties. 😒 This might help:

https://computingforgeeks.com/how-to-run-java-jar-application-with-systemd-on-linux/
If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing.
O/OA/A, Requests

DrFier

I've been using Systemd to run things.  That tutorial just says to use the full elf path, which I am worried will break with updates.  But if that's the only way to do it then I guess that's how it will get done.  I guess I could always make a find and replace script to go through the .service files when an update happens, but I was hoping there was an easier way.
Ons and Offs
Ideas
The Doctor is out.


Screen images simulated. Not an actual physician. Professional driver on a closed course, do not attempt. If you have an erection lasting more than four hours, contact your significant other.

Vekseid

How did you install java?

It should be creating a symlink in /usr/bin

DrFier

I did end up removing and readding the symlink after encountering another issue down the line.  For some reason a couple of symlinks had broken in there and that did end up fixing them.  Not sure why they broke in the first place though.
Ons and Offs
Ideas
The Doctor is out.


Screen images simulated. Not an actual physician. Professional driver on a closed course, do not attempt. If you have an erection lasting more than four hours, contact your significant other.

NestorAjax

Is the application compatible with OpenJDK? If so, maybe try just:

sudo apt install default-jre-headless

Or if the host system already has X11 packages, replace default-jre-headless with default-jre.