What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

VS Code can use JDK 8 for a project while a newer Java runtime launches its language server. These are separate settings: map JDK 8 as JavaSE-1.8 under java.configuration.runtimes, and, when required, set java.jdt.ls.java.home to a supported newer JDK. Current universal releases of the Red Hat Java extension require Java 21 for the language server; that does not mean your application must be upgraded from Java 8.

Quick fix

Open the Command Palette with Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS), then choose Preferences: Open User Settings (JSON). Add the settings below, replacing the sample locations with the JDK home directories installed in the environment where VS Code is running:

{
  "java.jdt.ls.java.home": "/path/to/jdk-21",
  "java.configuration.runtimes": [
    {
      "name": "JavaSE-1.8",
      "path": "/path/to/jdk-8"
    }
  ]
}

The language-server setting is needed when your extension build requires an external JDK. Some platform-specific Marketplace builds bundle a runtime, so a separate JDK for the language server may not be necessary. The JDK 8 entry maps the Java 8 execution environment for VS Code; it does not by itself determine every Maven or Gradle build. See the extension’s JDK requirements and VS Code’s Java project configuration guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save the file, run Java: Clean Java Language Server Workspace from the Command Palette, confirm the restart, and reopen the project. Then run Java: Configure Java Runtime to check the project runtime. If needed, use Java: Reload Projects.

Why VS Code may not find JDK 8

“Java is missing” can describe different problems. VS Code’s Java language server needs a runtime with which to start; your project separately needs the JDK and Java version used to compile or run its code. A current universal Red Hat Java extension may reject JDK 8 as its language-server runtime even when it can map JDK 8 to your project. The extension documentation describes Java 21 as the current requirement for that universal build. Requirements can vary by extension build and change over time, so check the current guidance if the message differs.

A JRE alone is not a development kit: normal compilation requires javac, which is included with a JDK. Also, installing the JDK is not the same as configuring VS Code to use it. A platform-specific extension build may bundle a language-server runtime, but that does not remove the need for a JDK suitable for building a Java 8 project.

1. Verify that JDK 8 is installed

In a terminal, check both the runtime and compiler:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
java -version
javac -version

A Java 8 installation reports a version beginning with 1.8, for example java version "1.8.0_381" and javac 1.8.0_381. Exact update numbers vary. If java works but javac is not found, you may have only a JRE installed, or the JDK’s bin directory may not be on PATH.

Find which installation your shell resolves:

Windows

where java
where javac
echo %JAVA_HOME%

You can test the configured home directly:

echo %JAVA_HOME%
"%JAVA_HOME%binjava.exe" -version
"%JAVA_HOME%binjavac.exe" -version

macOS and Linux

which java
which javac
echo "$JAVA_HOME"

These commands show what the shell finds, which may differ from the JDK you intend to use. Confirm the paths and versions before copying a directory into VS Code settings. For current Java setup guidance, see VS Code’s Java tutorial.

2. Install the Java extension that matches your settings

For the Red Hat Java workflow, install the Extension Pack for Java, or at minimum Language Support for Java™ by Red Hat. The pack includes language support and related project, test, debug, and Maven tools; VS Code lists its Java extensions on the Java extensions page.

Check which Java extension is actually active if its settings do not seem to apply. The Oracle Java Platform extension is a separate extension with its own configuration model; do not mix its instructions with the Red Hat extension’s java.* settings. See its Marketplace listing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Map JDK 8 as the project runtime

In java.configuration.runtimes, use the exact runtime name JavaSE-1.8 and a path to the JDK home directory—not to its bin subdirectory. The home should contain bin/java and bin/javac (or the Windows equivalents).

Windows example

{
  "java.configuration.runtimes": [
    {
      "name": "JavaSE-1.8",
      "path": "C:\Program Files\Java\jdk1.8.0_381"
    }
  ]
}

JSON requires backslashes to be escaped as \. Use the directory that exists on your machine; the version and vendor can result in a different name.

macOS example

{
  "java.configuration.runtimes": [
    {
      "name": "JavaSE-1.8",
      "path": "/Library/Java/JavaVirtualMachines/jdk1.8.0_381.jdk/Contents/Home"
    }
  ]
}

On macOS the home is commonly the bundle’s Contents/Home directory, not the outer .jdk directory. List installed JDKs with /usr/libexec/java_home -V; request a Java 8 home with /usr/libexec/java_home -v 1.8. Verify its compiler with "$(/usr/libexec/java_home -v 1.8)/bin/javac" -version. For installation-path background, see Oracle’s macOS installation guide.

Linux example

{
  "java.configuration.runtimes": [
    {
      "name": "JavaSE-1.8",
      "path": "/usr/lib/jvm/java-8-openjdk-amd64"
    }
  ]
}

Linux paths depend on distribution, package, vendor, and architecture. Other examples include /usr/lib/jvm/java-1.8.0-openjdk or a vendor-specific directory. Inspect the actual installation rather than assuming the example exists. On Debian-derived systems, these commands can help trace the selected executable:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
update-alternatives --list java
readlink -f "$(which java)"
dirname "$(dirname "$(readlink -f "$(which java)")")"

Whichever method you use, verify that the chosen home contains both Java and the compiler.

You can add more installed JDKs as additional runtime entries. For an unmanaged folder or standalone Java files, an entry can include "default": true to select its runtime by default. Set that only if Java 8 should be the default for those folders. Maven and Gradle projects generally take their Java level from build configuration rather than relying solely on this default. VS Code documents the runtime mapping and project behavior in its Java project guide.

4. Configure the language-server JDK separately, if needed

If the Java language server does not start, set java.jdt.ls.java.home to a JDK supported by your installed extension. For the current universal Red Hat extension version, the documented requirement is Java 21 or newer. For example:

{
  "java.jdt.ls.java.home": "C:\Program Files\Java\jdk-21"
}

On macOS or Linux, use the corresponding JDK home, such as /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home or /usr/lib/jvm/java-21-openjdk-amd64. Do not append /bin; the setting points to the JDK home. Prefer java.jdt.ls.java.home to the older, deprecated java.home setting. The extension can also find Java through its environment or PATH, but listing JDK 8 under java.configuration.runtimes does not satisfy a newer language-server requirement. Check the current requirements for your extension build.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Check Maven or Gradle independently

VS Code’s runtime mapping and a build tool’s compiler selection are related but not interchangeable. The project file or toolchain may determine how a build compiles code; the process running Maven or Gradle can also use a different JDK. VS Code’s build-tool guidance explains the distinction.

Maven

Inspect pom.xml for compiler settings such as maven.compiler.source, maven.compiler.target, or maven.compiler.release, and check which Java installation runs Maven:

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

A project using a supported compiler-plugin configuration may instead specify maven.compiler.release as 8. Follow the project’s Maven compiler setup rather than adding conflicting properties. Run mvn -version to see the Java version Maven reports, then run mvn clean test to validate the build.

Gradle

Inspect build.gradle or build.gradle.kts for toolchain or compatibility settings. A modern Gradle Groovy DSL toolchain can declare Java 8 like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(8)
    }
}

The Gradle daemon’s Java runtime is a separate compatibility question: the Gradle version in use determines which Java versions can run it. Check gradle -version and the project’s Gradle documentation. The Red Hat extension documents java.import.gradle.java.home for selecting the Java runtime used for Gradle import in applicable setups; it is not a substitute for a compatible Gradle version or the project’s toolchain. Run gradle clean test to validate the actual build.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Check settings scope and the VS Code environment

Java settings can come from User settings, Workspace settings such as .vscode/settings.json, folder-specific settings, or Remote settings. A more specific workspace setting can override the user value. Inspect those settings for stale entries such as java.home, an old java.jdt.ls.java.home, or a runtime path to a deleted JDK. Keep machine-specific absolute paths in User settings when possible, rather than committing one developer’s local path to a shared repository.

Also consider where VS Code and its Java extension are running. In WSL, SSH, a Dev Container, or another remote environment, the host’s JDK may not be visible to the extension. Install or expose the JDK in the environment where the Java extension operates and configure a path valid there. A Windows path such as C:Program FilesJavajdk1.8.0_381 is not a valid Linux path inside WSL or a Linux container.

Windows checks

  • Confirm the path is a JDK, not a jre directory, and does not end in bin.
  • Escape backslashes in JSON and check that JAVA_HOME points to an existing installation.
  • If several Java installations are on PATH, compare where java and where javac with the path in VS Code settings.
  • After changing environment variables, fully restart VS Code so it inherits the updated environment.
  • Confirm you edited settings in the active VS Code profile and, if remote, in the appropriate remote context.

macOS and Linux checks

  • Use the installed JDK home, not a symlink or path that resolves only to a JRE.
  • On macOS, check the selected JDK with /usr/libexec/java_home -V and verify the Java 8 compiler.
  • On Linux, trace symlinks and verify the resulting directory contains both bin/java and bin/javac.
  • Check that the terminal, VS Code, and remote workspace are using the same environment you intend to configure.

7. Diagnose the remaining error

JDK 8 is not detected

Check for a mistyped path, a missing compiler, an incorrect runtime name, a path ending in bin, malformed JSON, or settings saved in the wrong scope. Ensure the JDK is installed where VS Code’s Java extension runs. The runtime name should be JavaSE-1.8, not Java 8 or simply 8.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

JDK 8 is detected, but the language server will not launch

This can be a compatibility issue rather than a detection failure. If the extension reports that it needs a newer Java runtime, configure java.jdt.ls.java.home to a supported JDK—Java 21 or newer for the current universal Red Hat extension—and keep JDK 8 in java.configuration.runtimes for the project.

The settings look right, but errors remain

  1. Confirm the extension in use and check the current requirements for its installed build. A manually installed universal VSIX can behave differently from a platform-specific Marketplace build, which may include an embedded runtime.
  2. Inspect User, Workspace, folder, and Remote settings for overrides or obsolete paths.
  3. Run Java: Clean Java Language Server Workspace, confirm the restart, and then use Java: Reload Projects.
  4. Run Java: Configure Java Runtime to inspect the project association, and check the Java extension’s output or logs for the path or runtime error it reports.
  5. For Maven or Gradle, compare the version reported by mvn -version or gradle -version with the runtime shown in VS Code. Correct the build configuration or build-tool runtime separately if they differ.

Do not force JDK 8 into the language-server setting just because the project targets Java 8. That conflates the two jobs the JDKs perform.

8. Verify the result

Try this minimal source file in a test folder:

public class Main {
    public static void main(String[] args) {
        System.out.println(System.getProperty("java.version"));
    }
}

From a terminal where JDK 8 is selected, compile and run it:

javac -source 1.8 -target 1.8 Main.java
java Main

The compiler may print a warning about using an obsolete source or target option; the important check is that compilation succeeds and the program reports the runtime actually used to launch it. For a project build, also run its Maven or Gradle tests. A terminal’s java -version does not prove that Maven, Gradle, VS Code, and a remote extension host all use the same JDK.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • javac -version confirms the shell can access a compiler.
  • Java: Configure Java Runtime confirms the runtime VS Code associates with the project.
  • mvn -version or gradle -version shows the Java version used by the build tool.
  • java.jdt.ls.java.home, when needed, points to a JDK supported by the language server rather than automatically to the project’s JDK.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.