SonarQube Analyze is failing with "Could not find Java_home". Although Java_home is setup properly

  • SonarQube-enterprise-9.2.4 version is installed.
  • While running the Azure pipeline for SonarQube, the SonarQube Analyze task was failing with “Could not find java executable in JAVA_HOME or PATH”. Although the self-hosted azure agent is configured with JDK11 and below are the results from the agent directly.

$echo $JAVA_HOME
$which java
$./java -version
openjdk version “11.0.13” 2021-10-19 LTS

Since I am not sure, what else is missing, can any one help to get this fixed. I believe everything is setup properly, as I did the same setup for a DEV environment, it worked fine. Same steps were followed for this STAGING environment too, but this one fails.

Hi @naveenkrishnan
As we’ve exchanged about this problem privately, I’m catching a quick status here. Thanks for this first contribution to the community knowledge base!
To sum up, Java was installed on one specific build agent for your tests, but the pipeline was running on some other agent despite your configuration on the pipeline YAML definition.

Once the issue was spotted, you were able to pin the analysis to the right agent, and the analysis ran as expected.

1 Like

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