0

The following error occurs when trying to launch SonarQube:

C:\sonarqube-9.5.0.56709\bin\windows-x86-64>startsonar
wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Error: Could not create the Java Virtual Machine.
jvm 1    | Error: A fatal exception has occurred. Program will exit.
jvm 1    | Unrecognized option: --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
wrapper  | JVM exited while loading the application.
wrapper  | JVM Restarts disabled.  Shutting down.
wrapper  | <-- Wrapper Stopped
ParkerM
  • 302
  • 1
  • 4
  • 17
Shiv kumar K
  • 159
  • 8

1 Answers1

0

SonarQube 9 requires Java 11 to run, and later versions require Java 17. You can view the Supported Platforms in the documented prereq's here (select the version that is applicable to you): https://docs.sonarqube.org/9.6/requirements/prerequisites-and-overview/#supported-platforms

SonarQube will try and use the first java.exe it finds in the path, so if yours points to Java 8 or another unsupported version, then you'll see similar errors. To tell SonarQube to use a different installed Java version, set an env var SONAR_JAVA_PATH pointing to a compatible java.exe executable.
For example, say I have two installations C:\java\openjdk-8\ and C:\java\openjdk-17\, with JAVA_HOME=C:\java\openjdk-8\. To point SonarQube to the correct Java version, I would set SONAR_JAVA_PATH=C:\java\openjdk-17\bin\java.exe. This is documented under Setup and Upgrade -> Install the Server -> Adjusting the Java installation.

ParkerM
  • 302
  • 1
  • 4
  • 17