How I Fixed SonarQube Installation Error: Java Not Installed on My System

When I first downloaded and extracted SonarQube , I was excited to explore it for my ASP.NET Core project to analyze code quality.

But that excitement didn’t last long. As soon as I ran the StartSonar.bat file, the console closed instantly — and nothing happened.

When I checked Task Manager , I noticed there was no java.exe process running either. That’s when I realized something was definitely wrong.

Before we jump into the fix, here’s a quick look at what you’ll learn in this post

What You’ll Learn

  • Why SonarQube closes right after you start it

  • The real reason behind the issue

  • Simple steps and commands to fix it

  • How to check if Java and SonarQube are working properly

  • Tips to avoid this problem next time

The Root Cause

After checking the logs located in:

  
    C:\\sonarqube\\logs\\web.log
  

I found the real issue — Java wasn’t installed on my system.

SonarQube runs on the Java platform , so it requires Java 17 or higher to start.

Without Java, the console window closes immediately after you try to run StartSonar.bat .

Step-by-Step Solution

How I solved the problem:

Downloaded and Installed Java 17

I downloaded Temurin JDK 17 from Adoptium.net .

Then, I installed it using the default path:

  
    C:\\Program Files\\Eclipse Adoptium\\jdk-17\\
  

Verified the Java Installation

After installation, I opened Command Prompt and ran:

  
    java -version
  

Output

  
    openjdk version "17.x.x"
  

This confirmed that Java was installed successfully.

Set the JAVA_HOME Environment Variable

To ensure SonarQube recognizes Java, I set the JAVA_HOME variable:

  • Variable name: JAVA_HOME

  • Variable value

          
            C:\\Program Files\\Eclipse Adoptium\\jdk-17
          
        

Then, I added this to the Path variable:

  
    %JAVA_HOME%\\bin
  

Restarted the System and Ran SonarQube Again

After a restart, I executed the command again:

  
    StartSonar.bat
  

This time, the console stayed open , and after a minute or two, I saw the message confirming SonarQube was up and running .

SonarQube Up

Accessing SonarQube

opened my browser and navigated to:

http://localhost:9000

The SonarQube loaded successfully!

loginsonar

Default Login Credentials:

  • Username: admin

  • Password: admin

The SonarQube dashboard loaded successfully!

Dashboard

Diagnostic Commands I Used

Here are the checks I ran while troubleshooting:

1. To check if Java is installed

  
    java -version
  

If you see:

  
    'java' is not recognized as an internal or external command
  

That means Java is not installed .

To check SonarQube logs for errors

Navigate to:

  
    C:\\sonarqube\\logs\\web.log
  

You’ll often find the reason why SonarQube failed to start here.

Key Takeaways

If your StartSonar.bat closes immediately or SonarQube doesn’t load on localhost:9000 , follow these quick checks:

Make sure Java 17+ is installed

Set the correct JAVA_HOME environment variable

Restart your system before running SonarQube again

Check logs under C:\\sonarqube\\logs for any errors

Conclusion

Setting up SonarQube can be tricky the first time — especially if you miss a small dependency like Java.

Once it’s up and running, though, it’s an excellent tool for improving code quality, consistency, and security in your projects.

I hope my experience helps you avoid the same mistake.

Always verify your Java installation before starting SonarQube!