• “SonarQube requires Java 11+ to run“ for java 1.8.0_221


    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

    1. jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
    2. jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
    3. jvm 1 |
    4. jvm 1 |
    5. jvm 1 | WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: SonarQube requires Java 11+ to run
    6. jvm 1 | java.lang.IllegalStateException: SonarQube requires Java 11+ to run
    7. jvm 1 | at org.sonar.application.App.checkJavaVersion(App.java:93)
    8. jvm 1 | at org.sonar.application.App.start(App.java:56)
    9. jvm 1 | at org.sonar.application.App.main(App.java:98)
    10. jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    11. jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    12. jvm 1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    13. jvm 1 | at java.lang.reflect.Method.invoke(Method.java:498)
    14. jvm 1 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
    15. jvm 1 | at java.lang.Thread.run(Thread.java:748)
    16. wrapper | <-- Wrapper Stopped
    17. 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.

    Share

    Improve this question

    Follow

    asked Nov 20, 2019 at 6:33

    Soheb Khalid

    31111 gold badge22 silver badges55 bronze badges

    • 2

      as it says requires Java 11+ to run install jdk 11 or more currently its 13.XX or download java 8 compatible version of SonarQube 

      – Ashwin Subramanya

       Nov 20, 2019 at 6:46

    Add a comment

    5 Answers

    Sorted by:

                                                  Highest score (default)                                                                   Trending (recent votes count more)                                                                   Date modified (newest first)                                                                   Date created (oldest first)                              

    61

    Install JDK version 11 (download from Java Downloads | Oracle). If the download link not working, google "JDK 11 download".

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

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

    Share

    Improve this answer

    Follow

    edited Jul 31, 2020 at 14:38

    Ananthapadmanabhan

    5,09355 gold badges2020 silver badges3737 bronze badges

    answered Jan 22, 2020 at 4:55

    Yang You

    2,5382424 silver badges2929 bronze badges

    • 3

      For those who have several Java versions installed - this answer is the solution. By default parameter value is 'java' which is referencing the latest JDK version installed on your system (JDK 13 in my case). This can make error rise again even while you installed JDK 11 

      – Nozim Turakulov

       Feb 3, 2020 at 15:03
    • 1

      highlight is changing in wrapper.conf. You rock! 

      – UI_Dev

       May 18, 2020 at 14:06
    • 3

      \conf\wrapper.conf is in your SonarQube folder by the way 

      – Touré Holder

       Jul 20, 2020 at 19:46
    • 1

      FYI you'll need to set it to the executable%JAVA_HOME%/bin/java f.i. if java.exe is not in your environmental PATH var defined 

      – electrobabe

       Jul 27, 2021 at 19:28
    • Is no one else concerned that a package used for static analysis, including (minimum) security analysis requires a package installed on your server that is widely regarded as not secure? 

      – Trashman

       Jan 17 at 19:35

    Add a comment

    12

    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,

        1. #wrapper.java.command=java
        2. 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.

    Share

    Improve this answer

    Follow

    answered May 22, 2020 at 20:16

    Amila Viraj

    8961010 silver badges99 bronze badges

    • 1

      Well explained. Thanks a lot. 

      – Chirag Savsani

       Nov 4, 2020 at 3:56
    • @ChiragSavsani I am glad that you found this helpful :) 

      – Amila Viraj

       Nov 5, 2020 at 8:39

    Add a comment

    4

    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, ...).

    Share

    Improve this answer

    Follow

    answered Nov 21, 2019 at 16:28

    Alban A. - SonarSource Team

    75944 silver badges66 bronze badges

    Add a comment

    0

    There are useful links given in other comments to install JAVA JDK 11 in above link. However, I would recommend to install latest version from following link (because you have just downloaded latest sonarqube) for better compatibly.

    SDK download link: Java Downloads | Oracle

    Share

    Improve this answer

    Follow

    answered Apr 7, 2020 at 14:46

    Deepak Rajpal

    71311 gold badge66 silver badges1111 bronze badges

    Add a comment

    0

    I encountered a similar situation. I had JDK 11 installed and SQ was fine with it. It was the only Java on my machine. Then, there was an organization wide push of Java 8 which reset the path system environment variable to Java 8, thereby disrupting the ability to run SQ (even though Java 11 was still present.)

    Removing Java 8 was not a solution since doing so would result in the absence of Java 8 being detected and provoke another automated push of Java 8 and the corresponding reset of the path system environment variable. The scanner looks no deeper than the presence of Java 8. So, as long as it is there, it does not touch the path system environment variable.

    Resetting the path system environment variable to Java 11 and setting JAVA_HOME was solution. SQ saw Java 11, so it could run and the scanner saw Java 8, so it took no further action.

    Share

    Improve this answer

    Follow

    answered Sep 3, 2020 at 21:53

    jboldia

    2133 bronze badges

    • you added these lines"vim .bash_profile JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.7.10-4.el7_8.x86_64/bin/java" " in .bash_profile ? 

      – Youssef Boudaya

       May 17, 2021 at 10:41

    Add a comment

  • 相关阅读:
    A First Look At Java
    【进阶篇】Java 实际开发中积累的几个小技巧(一)
    如何当好硬软件助理工程师——实习周报(一)
    计算机毕业设计Python+django的火车票售票系统(源码+系统+mysql数据库+Lw文档)
    网络基本结构及数据传输方式
    指夹式脉搏血氧仪方案
    pip 安装任意软件包报错
    OpenCV(三十四):轮廓外接最大、最小矩形和多边形拟合
    基于Vue+SpringBoot的超市账单管理系统 开源项目
    网络协议学习DAY1
  • 原文地址:https://blog.csdn.net/wxb880114/article/details/127701868