On RHEL, where does Jenkins look for Java binaries?

I am trying to get Jenkins up and running on an RHEL7 machine. I have installed JDK 11 and Jenkins just fine. However, when trying to start Jenkins with systemctl, Jenkins fails to start and complains that it’s not able to find a valid Java installation.

Where does Jenkins look for Java binaries by default?

Is there an environment variable specific to Jenkins I can set to override this behavior? I have tried set ting $JAVA_HOME and have also added it to $PATH. I am able to invoke the Java binaries fine on their own.

You’ll want to set JAVA_HOME and/or PATH in your systemd config.

how did you try setting those variables already?

1 Like

Ok, where does the systemd config live?

I have them both set in my .bashrc as follows:

export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-"

Not the exact right response, but this canned response/template should give you all the details about jenkins and systemd. Nothing really reads .bashrc except your login.

Hi there,

Jenkins 2.332.1 switched Jenkins from using System V init to use systemd with its Linux package installers for Debian, Ubuntu, Red Hat, Alma, openSUSE, Rocky, and more. The LTS Upgrade Guide describes that transition and how to adapt your environment to the transition.

There is a blog post about it as well at

There is also a video introduction for RPM based distributions like Red Hat Enterprise Linux, Alma Linux, Rocky Linux, Oracle Linux, and Amazon Linux.

There is also a video introduction for deb based distributions like Debian and Ubuntu

oh Managing systemd services might be more susinct

1 Like

That worked. Thanks!