Could not find 'java' executable in JAVA_HOME


I am encountering the below issue on CentOS Linux release 7.9.2009 (Core)

java -version

openjdk version “” 2020-11-04 LTS
OpenJDK Runtime Environment 18.9 (build
OpenJDK 64-Bit Server VM 18.9 (build, mixed mode, sharing)
(reverse-i-search)`son’: stat /opt/scannerdir/^Cnar-scanner-




Could not find ‘java’ executable in JAVA_HOME or PATH.

Any clue? Thanks in advance. I look forward to hearing from you. Please let me know if you need any additional information.

Best Regards,


Hi Kaushal, welcome to the SonarSource Community!

It appears based on your pasted output that you downloaded the version of sonar-scanner that includes an embedded JRE yet you also have a separate JDK already installed. In this case, you may wish to use the sonar-scanner zip install that does not bundle another JRE.

Yet still, it should have succeeded. How exactly did you invoke sonar-scanner and from which directory? Did you add its bin directory to your PATH first as our docs suggest? Is it being invoked directly or within another shell or script of some kind?