# Sonar-scanner cli

**URL:** <https://community.sonarsource.com/t/sonar-scanner-cli/110473>\
**Category:** SonarQube Server / Community Build\
**Created:** [March 5, 2024, 10:02am UTC](https://community.sonarsource.com/t/sonar-scanner-cli/110473 "2024-03-05T10:02:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![timmy.fieremans](https://avatars.discourse-cdn.com/v4/letter/t/da6949/32.png) [@timmy.fieremans](https://community.sonarsource.com/u/timmy.fieremans)\
**Post date:** [March 5, 2024, 10:02am UTC](https://community.sonarsource.com/t/sonar-scanner-cli/110473/1 "2024-03-05T10:02:26Z")

</div>

Hi,  
We just did the upgrade to sonarqube 10.3. We have sonar scanner cli running on a server where our jenkins is also running. Apparently we need to upgrade to java 17 for the scanner to work now. Our jenkins is still running on java 11. My idea was to install java 17 in parallel with java 11 and tell sonar-scanner to use java 17. Is there such an option in sonar-scanner to say which java version it needs to use? I couldn’t find anything in the documentation.

Kind regards,  
Timmy

---

<div class="post-metadata">

**Author:** ![anon67236913](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@anon67236913](https://community.sonarsource.com/u/anon67236913)\
**Post date:** [March 5, 2024, 11:31am UTC](https://community.sonarsource.com/t/sonar-scanner-cli/110473/2 "2024-03-05T11:31:11Z")

</div>

Hi,

you may change the Java version before calling the Sonarqube CLI scanner, i.e.

```auto
stage('Sonarqube') {
  env.JAVA_HOME= tool 'java17'
  env.PATH="${env.JAVA_HOME}/bin:${env.PATH}"
  props = readJSON file: 'package.json'
  sonarProps = """
                sonar.branch.name=xxx\n
                sonar.projectKey=xxx\n
                sonar.projectName=${props.name}\n
                sonar.projectVersion=${props.version}\n
                sonar.sourceEncoding=UTF-8\n
                sonar.sources=src\n
                sonar.exclusions= **/node_modules/** \n
               """
  writeFile file: "sonar-project.properties", text: sonarProps
  scannerHome = tool 'sonarCLI480'
  withSonarQubeEnv('xxx') {
      sh "${scannerHome}/bin/sonar-scanner"
  }
}

```

Gilbert
