DotNet scan fails with java error

Must-share information (formatted with Markdown):

  • SonarQube on Windows Community Edition Version 8.8 (build 42792)
  • Trying to run my first DotNet scan
  • I’ve installed the latest JDK, installed DotNet (using dotnet tool install --global dotnet-sonarscanner), restarted my local sonarqube daemon. Getting the error “Files\Java\jdk-11.0.8\bin”" was unexpected at this time."

I’m running the following command:
dotnet sonarscanner end /d:sonar.login=“xxxxx” (where xxxx is my token)

SonarScanner for MSBuild 5.2
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
Calling the SonarScanner CLI…
Files\Java\jdk-11.0.8\bin"" was unexpected at this time.
The SonarScanner did not complete successfully
13:41:39.555 Post-processing failed. Exit code: 1

My path env variable contains c:\Program Files\Java\jdk-14.0.2\bin as well:

I’m assuming that somewhere I’m missing quotes or something as it’s breaking on the space in Program Files. But unclear where that is - I checked the sonar properties and wrapper file but didn’t see anything in there related to java paths.

Thanks in advance, new to SonarQube but trying to do a proof of concept to show to exec. leadership.

Hey there.

What’s your JAVA_HOME variable set to?

It’s currently set to

“C:\Program Files\Java\jdk-11.0.8\bin”

(with quotes)

Thanks Colin, you got me on the right path.

I ended up fixing by setting my JAVA_HOME variable to:

C:\Program Files\Java\jdk-11.0.8
(without the \bin at the end).

For reference, my wrapper.conf contains this:\Program Files\Java\jdk-11.0.8\bin\java.exe

1 Like

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