Configuring sonar-scanner in Debian: "Could not find 'java' executable in JAVA_HOME or PATH."

I am trying to configure for the first time SonarCloud with Debian 9 for a Java project hosted on GitHub. I have downloaded sonar-scanner-cli 4.4.0.2170 and added the /bin folder to the $PATH evnironment variable, as requested.
After having followed all the steps required, when I run the sonar-scanner command, with or without the suggested parameters, I obtain:

Could not find 'java' executable in JAVA_HOME or PATH.

But both variables are correctly set, I’m trying all the possible combinations of both variables but it does not seem to work. I’m pretty new to SonarCloud, so I ask if someone can give me any suggestion on how to solve this problem.

Hi @MS1, welcome to the SonarSource Community!

It looks like maybe you downloaded the archive of the scanner that relies an an external JVM. This is great if you already have one, but in your case it sounds like you don’t and likely don’t use java for other software. If you revisit the scanner page in our docs, the version for “Linux 64-bit” should include a JVM and then have no problem finding java because it will be bundled within.

1 Like

Hello @Jeff_Zapotoczny, thank you for your answer. The problem was exactly the opposite: I have a pre-installed JVM, and I use java for other software with no problems. The version I downloaded (and that caused the problem) was the “Linux 64-bit” one, but consulting the link that you provided, I discovered the “All platforms” versions. Downloaded and configured correctly, it works perfectly! So, problem solved. Thank you!

1 Like

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