close

[Solved] SonarQube: Error: Could not create the Java Virtual Machine

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error SonarQube: Error: Could not create the Java Virtual Machine in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How SonarQube: Error: Could not create the Java Virtual Machine Error Occurs?

Today I am facing the following error SonarQube: Error: Could not create the Java Virtual Machine in Java.

How To Solve SonarQube: Error: Could not create the Java Virtual Machine Error ?

  1. How To Solve SonarQube: Error: Could not create the Java Virtual Machine Error ?

    To Solve SonarQube: Error: Could not create the Java Virtual Machine Error This means that the batch script that attempts to start Sonar is passing in some JVM args that are no longer valid.

  2. SonarQube: Error: Could not create the Java Virtual Machine

    To Solve SonarQube: Error: Could not create the Java Virtual Machine Error This means that the batch script that attempts to start Sonar is passing in some JVM args that are no longer valid.

Solution 1

Your problem most likely occurs due to the fact that you are attempting to run SonarQube with an unsupported Java version.

From the error log, I presume that you are attempting to run it using either Java 14 or Java 15 based on these lines:

Picked up _JAVA_OPTIONS: -Xmx1024M
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

The CMS collector was deprecated in Java 9 and removed altogether in Java 14:

This means that the batch script that attempts to start Sonar is passing in some JVM args that are no longer valid.

Based on their documentation that only supported Java version are 8 and 11

and version above those are not supported:

SonarQube scanners require version 8 or 11 of the JVM and the SonarQube server requires version 11. Versions beyond Java 11 are not officially supported.

I suggest you attempt to run it using the correct Java version. Also please check the related documentation beforehand to avoid such issues.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read