ERROR! You do not have the Java Runtime Environment installed, please install Java JRE from https://adoptopenjdk.net/?variant=openjdk11 and try again

systemd is a service in the background. I think it is started before the script in /etc/profile/ is called. You could try this: https://coreos.com/os/docs/latest/using-environment-variables-in-systemd-units.html and set it inside the systemd environment.