Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

VS Code Gradle extension says there is no connection to the Gradle server

ErrorNo connection to the gradle server. Try restarting the server.

Short answer

The Gradle for Java extension talks to a background task server. The message means that server stopped or never started. Use Restart Server first. If it fails again, the JDK used to launch Gradle is probably wrong, so point java.import.gradle.java.home at a JDK your Gradle version supports.

  • Applies to VS Code with Gradle for Java extension, Gradle 8.x and 9.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check that the Gradle wrapper runs outside the editor. If it fails in a terminal too, the problem is Gradle or the JDK, not the extension.

    ./gradlew --version
  2. 2Match what you see, then jump to its fix

    1. 1The message appears in the Gradle view, and Restart Server is offeredThe task server stopped or failed to startFix
    2. 2Restart Server does not help, and ./gradlew --version in a terminal shows a different Java than the one the editor usesGradle is launched with an unsuitable JDKFix

What does the error look like?

  • No connection to the gradle server. Try restarting the server.

Cause 1 of 2

The task server stopped or failed to start

1Check

The extension README says this message means the task server stopped or failed to start.

# Gradle view in the Explorer sidebar shows the message

2Fix

Click Restart Server in the notification, then wait for the Gradle view to reload.

# notification button: Restart Server

3Verify

The Gradle view lists the project and its tasks.

# Gradle view in the Explorer sidebar

Confirmed by github.com

Did this fix it?

Cause 2 of 2

Gradle is launched with an unsuitable JDK

1Check

java.import.gradle.java.home is the JDK used to launch Gradle daemons for imports and tasks. It is separate from java.jdt.ls.java.home, which only runs the Java language server.

./gradlew --version

2Fix

Set java.import.gradle.java.home in settings.json to a JDK your Gradle version supports (Java 17 needs Gradle 7.3 or newer, Java 21 needs 8.5, Java 25 needs 9.1.0), then restart the server.

{
  "java.import.gradle.java.home": "/path/to/jdk-21"
}

3Verify

The task list loads without the connection message.

./gradlew --version

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Keep one JDK path in java.import.gradle.java.home that matches your Gradle wrapper.
  • Update the extension when you move to a new major Gradle version.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

Gradle runs no Cucumber scenarios from my feature files

Feature files exist under src/test but nothing runs

Cucumber runs on the JUnit Platform, so Gradle must call useJUnitPlatform() and have the cucumber-junit-platform-engine on the test classpath.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.