Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"SonarQube requires Java 11+ to run" for java 1.8.0_221

Tags:

sonarqube

I have downloaded SonarQube (7.9.x LTS (July 2019)).

I have java version "1.8.0_221" in 64bit windows machine. Environment variable JAVA_HOME is set to C:\Program Files\Java\jdk1.8.0_221, path: C:\Program Files\Java\jdk1.8.0_221\bin & C:\Program Files\Java\jre1.8.0_221\bin.

I encountered following error while running StartSonar.bat

jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    |
jvm 1    | WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: SonarQube requires Java 11+ to run
jvm 1    | java.lang.IllegalStateException: SonarQube requires Java 11+ to run
jvm 1    |      at org.sonar.application.App.checkJavaVersion(App.java:93)
jvm 1    |      at org.sonar.application.App.start(App.java:56)
jvm 1    |      at org.sonar.application.App.main(App.java:98)
jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
jvm 1    |      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
jvm 1    |      at java.lang.reflect.Method.invoke(Method.java:498)
jvm 1    |      at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
jvm 1    |      at java.lang.Thread.run(Thread.java:748)
wrapper  | <-- Wrapper Stopped
Press any key to continue . . .

I have tried to implement solutions that I found in various blogs,but still no luck. I tried by making changes in wrapper.conf file at command

wrapper.java.command=java

or

wrapper.java.command=C:\Program Files\Java\jdk1.8.0_221\bin\java

as well as

wrapper.java.command=C:\Program Files\Java\jdk1.8.0_221\bin\java

Please suggest solution for this issue. Note: I am running StartSonar.bat without admin permission don't know if it has any impact.

like image 343
Soheb Khalid Avatar asked Nov 20 '19 06:11

Soheb Khalid


People also ask

Is Java 11 mandatory for SonarQube?

The SonarQube server require Java version 11 and the SonarQube scanners require Java version 11 or 17. SonarQube is able to analyze any kind of Java source files regardless of the version of Java they comply to. We recommend using the Critical Patch Update (CPU) releases.

What SonarQube version is compatible with a Java 8?

SonarQube supports Java 8 since end of March 2014 (with some hickups at first, which were fixed in version 2.2 of its Java plugin).

Can we use SonarQube for Java 8?

Prerequisite. The only prerequisite for running SonarQube is to have Java (Oracle JRE 8 or OpenJDK 8) installed on your machine. Note: On Mac OS X it is highly recommended to install Oracle JDK 8 instead of the corresponding Oracle JRE since the JRE installation does not fully set up your Java environment properly.

How do I run SonarQube with Java 11?

SonarQube requires Java 11+ to run The solution is to download and install Java 11+ from the official site (I installed Java JDK 12). Another things to make sure is that we register the path to this Java (e.g. “C:\Program Files\Java\jdk-12.0. 1\bin”) in our PATH of system environment variable.


4 Answers

Install JDK version 11 (download from https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html). If the download link not working, google "JDK 11 download".

and change the value for the line below in <sonar>\conf\wrapper.conf:

wrapper.java.command=C:\Program Files\Java\jdk-11.0.6\bin\java
like image 51
Yang You Avatar answered Nov 10 '22 00:11

Yang You


Please follow the below steps:

  1. First you need to download and install java 11 as SonarQube requires java 11 as the support platform.

  2. If you have not set the default java path environment to jdk 11 (if you have another java version, i.e. jdk 1.8 set as default java path in your system), then you need to follow the below step, (Otherwise you don't need this configuration and you can just run)

    • Go to the SonarQube folder path and open the "wrapper.conf" file inside the "conf" folder.
    • Just comment the default java configuration and set new java 11 path configuration as below,

      
       #wrapper.java.command=java
       wrapper.java.command=C:\Program Files\Java\jdk-11.0.7\bin\java
      
      

      (note: please copy the java 11 path from your machine , don't copy the above sample path)

Now you should be able to run successfully.

like image 42
Amila Viraj Avatar answered Nov 10 '22 00:11

Amila Viraj


Please follow the below steps:

  1. First you need to download and install java 11 as SonarQube requires java 11 as the support platform.

  2. If you have not set the default java path environment to jdk 11 (if you have another java version, i.e. jdk 1.8 set as default java path in your system), then you need to follow the below step, (Otherwise you don't need this configuration and you can just run)

    • Go to the SonarQube folder path and open the "wrapper.conf" file inside the "conf" folder.
    • Just comment the default java configuration and set new java 11 path configuration as below,

      
       #wrapper.java.command=java
       wrapper.java.command=C:\Program Files\Java\jdk-11.0.7\bin\java
      
      

      (note: please copy the java 11 path from your machine , don't copy the above sample path)

Now you should be able to run successfully.

like image 27
Amila Viraj Avatar answered Nov 10 '22 00:11

Amila Viraj


It's explicit in the "Release 7.9 LTS Upgrade Notes" announcement SonarQube upgrade notes

The SonarQube server now requires Java 11.

There's no possible workaround, but this concern only the SonarQube server part, not the machines that analyze your projects on which you may continue to use Java 8 (using sonar-scanner, maven, gradle, ...).

like image 45
Alban A. - SonarSource Team Avatar answered Nov 10 '22 00:11

Alban A. - SonarSource Team