Could not find 'java' executable in JAVA_HOME or PATH

Template for a good new topic, formatted with Markdown:

  • ALM used = Azure DevOps
  • CI system used = Azure DevOps
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

  1. /data/agents/azagent1/_work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.10.0/sonar-scanner/bin/sonar-scanner

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

##[error]The process ‘/data/agents/azagent1/_work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.10.0/sonar-scanner/bin/sonar-scanner’ failed with exit code 1

Finishing: Run Code Analysis

on prepare command, java not found.
JAVA_HOME is set but not in Path

/usr/bin/bash --noprofile --norc /data/agents/azagent1/_work/_temp/7745c37b-0030-4c61-8850-9b4b1183346c.sh

Java home
/usr/bin/java

Path home
/home/ec2-user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

why it’s not work ?
i’m on CENTOS Amazon linux latest version.

Hi @xtop-Nexity and welcome to the community.

You have to check on the capabilities tab of your agent that you have the “java” property set (either it’s set automatically, or you can add it manually in the “User defined capabilities”

HTH,
Mickaël

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