# Could not find 'java' executable in JAVA\_HOME or PATH

**URL:** <https://community.sonarsource.com/t/could-not-find-java-executable-in-java-home-or-path/131235>\
**Category:** SonarQube Server / Community Build\
**Created:** [November 28, 2024, 8:52am UTC](https://community.sonarsource.com/t/could-not-find-java-executable-in-java-home-or-path/131235 "2024-11-28T08:52:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devadakshith](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Devadakshith](https://community.sonarsource.com/u/Devadakshith)\
**Post date:** [November 28, 2024, 8:52am UTC](https://community.sonarsource.com/t/could-not-find-java-executable-in-java-home-or-path/131235/1 "2024-11-28T08:52:07Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) : 10.7
- how is SonarQube deployed: zip, Docker, Helm : zip
- what are you trying to achieve : upgrade sonarqube server version from 9.9 to 10.7
- what have you tried so far to achieve this : upgrade successful

Hi team,  
we are seeing below error while scanning on our java project which is using declarative pipeline.  
we tried providing the path to java home (/etc/alternatives/jre\_17/bin)  
Could not find ‘java’ executable in JAVA\_HOME or PATH.

we are using sonar-scanner-cli docker image verison 6.2.1

-Dsonar.java.jdkHome=/etc/alternatives/jre\_17/bin/ - is been passed to the scan stage as sonar properties.

env vars on sonar-scanner env:

```auto
bash-4.4$ env | grep -i path

NODE_PATH=/opt/node-v20.10.0-linux-x64/lib/node_modules

PATH=/opt/sonar-scanner/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/sbin:/opt/node-v20.10.0-linux-x64/bin:/etc/alternatives/jre_17/bin

bash-4.4$ env | grep -i java

JAVA_HOME=/etc/alternatives/jre_17/bin

```

java version:

```auto
bash-4.4$ java --version

openjdk 17.0.13 2024-10-15 LTS

OpenJDK Runtime Environment (Red_Hat-17.0.13.0.11-1) (build 17.0.13+11-LTS)

OpenJDK 64-Bit Server VM (Red_Hat-17.0.13.0.11-1) (build 17.0.13+11-LTS, mixed mode, sharing)

bash-4.4$

```

please assist.

Thanks!  
Dev

---

<div class="post-metadata">

**Author:** ![Devadakshith](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@Devadakshith](https://community.sonarsource.com/u/Devadakshith)\
**Post date:** [November 29, 2024, 11:20am UTC](https://community.sonarsource.com/t/could-not-find-java-executable-in-java-home-or-path/131235/3 "2024-11-29T11:20:46Z")

</div>

Hi team, please disregard this thread as no further assistance is needed. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [March 4, 2025, 5:06pm UTC](https://community.sonarsource.com/t/could-not-find-java-executable-in-java-home-or-path/131235/4 "2025-03-04T17:06:01Z")

</div>

Closed on March 4, 2025, 5:06pm UTC

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