Hi,
As has been reported on similar threads here I’m running into the “Could not find ‘java’ executable in JAVA_HOME or PATH.” issue with sonarscanner cli tool. The underlying OS is fedora 34 running in a docker container. The binaries are from the 4.7.0 release with the bundled JRE.
FROM fedora:34
RUN dnf install -y wget unzip && \
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip && \
unzip sonar-scanner-cli-4.7.0.2747-linux.zip && \
mkdir /opt/sonar-scanner && \
mv sonar-scanner-4.7.0.2747-linux/* /opt/sonar-scanner
ENV JAVA_HOME=/opt/sonar-scanner/jre
ENV PATH="$JAVA_HOME/bin:${PATH}"
Inside this container the following script is being run, additional commands were added to aid with debug.
+ stat -c '%a %n' /opt/sonar-scanner/jre/bin/java
755 /opt/sonar-scanner/jre/bin/java
+ ls -l /opt/sonar-scanner/jre/bin
total 16
-rwxr-xr-x. 1 root root 12768 Feb 8 16:49 java
+ ls /opt/sonar-scanner/jre/bin
java
+ echo $JAVA_HOME
/opt/sonar-scanner/jre
+ echo $PATH
/opt/sonar-scanner/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ java --version
openjdk 11.0.14.1 2022-02-08
OpenJDK Runtime Environment Temurin-11.0.14.1+1 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM Temurin-11.0.14.1+1 (build 11.0.14.1+1, mixed mode)
+ /opt/sonar-scanner/bin/sonar-scanner -X -e -Dsonar.login=<login>
Could not find 'java' executable in JAVA_HOME or PATH.
So far the pathing seems correct, both ENV variables have been setup, permissions seem ok, java can be run fine outside the sonar-scanner. Wondering what else to try. Thanks