Java executable not found when running sonar scanner in a slave Jenkins node

Hi,
as the title says I’m having trouble running the sonar scanner on a distributed jenkins builder node.
The error I got is “Could not find ‘java’ executable in JAVA_HOME or PATH.”
but I developed a custom container already containing Java JDK 11, checked PATH and JAVA_HOME variables and seems to be correctly configured.
java -version commands returns
openjdk version “11.0.14.1” 2022-02-08
OpenJDK Runtime Environment 18.9 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.14.1+1, mixed mode, sharing).
Also Jenkins seems to be able to correctly connect and he requires java in path and home.

My current running version is
Jenkins 2.332.1
SonarScanner is installed on master and slave nodes using sonar plugin for Jenkins at version 4.7.0.2747, install automatically flag is checked.
This shouldn’t be a pipeline error since the master node works just as expected and I don’t see connection issue, simply java errors.
I already tried uninstalling java from the node and reinstalling it manually, adding to the path and java home the correct location for the package but still does not seems to work

[EDIT]
I managed to fix it manually setting the path inside the sonar scanner script

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.