Sonar Scanner's Embedded JRE is not recognized

Hi Team,
I’m currently using SonarQube Community Edition 8.6 standalone instance and sonar scanner cli version is
I’m trying to integrate sonarqube in my existing bitbucket pipeline.

When executing sonarqube build task in bitbucket cloud build environment, sonar scanner was not able to recognize the embedded JRE.

I tried setting the JAVA_HOME & Path explicitly in the build task, after this in my local environment (using sonar scanner sonar-scanner-, when i run the task, embedded JRE is recognized and necessary scanning happens as expected. But still the execution fails in bitbucket pipeline execution.

Error Logs for your reference,

– JAVA_HOME : /opt/atlassian/pipelines/agent/build/src/
– PATH : /opt/atlassian/pipelines/agent/build/src/
/bin/sh: java: not found
sonar-scanner- exec: line 66: /opt/atlassian/pipelines/agent/build/src/ not found

Can someone help me in fixing this?