Skip to content

SonarQube setup error – java.lang.IllegalStateException: SonarQube requires Java 11+ to run – Solution – Install Java 11

This tutorial helps you install Java 11 on Linux based machines to resolve SonarQube errors.

When you are setting up the latest distribution of SonarQube on the latest Linux based systems, there are chances you would face the following exception.

WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: SonarQube requires Java 11+ to run
java.lang.IllegalStateException: SonarQube requires Java 11+ to run
        at org.sonar.application.App.checkJavaVersion(
        at org.sonar.application.App.start(
        at org.sonar.application.App.main(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(

The latest version of SonarQube requires Java 11 to be setup on the system. You can just run the following set of commands to install Java 11. As simple as that.

Install OpenJDK 11.

yum -y install java-11-openjdk java-11-openjdk-devel

Create a new script setting the environment variables for Java 11.

cat > /etc/profile.d/ <<EOF 
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
export PATH=\$PATH:\$JAVA_HOME/bin
export CLASSPATH=.:\$JAVA_HOME/jre/lib:\$JAVA_HOME/lib:\$JAVA_HOME/lib/tools.jar

Run the script file to set JAVA_HOME environment variable.

source /etc/profile.d/

Update Java alternatives to choose the version you would like to use.

update-alternatives --config java

Check Java version to make sure the correct version of Java is set.

java -version

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.