Skip to content

JDK Requirements

Fred Bricon edited this page Jul 22, 2020 · 25 revisions

vscode-java requires a Java Development Kit to run (NOT A JRE!). Since vscode-java 0.65.0, Java 11 is the minimum required version.

Setting the JDK

The path to the Java Development Kit is searched in the following order:

  • the java.home setting in VS Code settings (workspace then user settings)
  • the JDK_HOME environment variable
  • the JAVA_HOME environment variable
  • on the current system path

Note: The path should end at the parent folder that contains the bin folder. Example Path: Use /usr/lib/jvm/java-11 if bin exists at /usr/lib/jvm/java-11/bin.

This JDK will be used to launch the Java Language Server. And by default, will be used to compile your projects.

If you need to compile your projects against a different JDK version, it's recommended you configure the java.configuration.runtimes property in your user settings, eg:

"java.configuration.runtimes": [
  {
    "name": "JavaSE-1.8",
    "path": "/path/to/jdk-8",
  },
  {
    "name": "JavaSE-11",
    "path": "/path/to/jdk-11",
  },
  {
    "name": "JavaSE-14",
    "path": "/path/to/jdk-14",
    "default": true
  },
]

The default runtime will be used when you open standalone Java files.

About the Java 11 requirement

The Eclipse Platform has decided to require Java 11 as the minimum requirement for its September 2020 release. See https://www.eclipse.org/lists/eclipse-pmc/msg03821.html.

Because vscode-java depends on the Eclipse JDT.LS server, that same requirement to vscode-java. But the timeline is be more aggressive: Indeed, vscode-java usually consumes JDT.LS builds that depend on bleeding edge JDT features, so effectively shipping pre-release versions of Eclipse Platform/JDT. As of July 22nd, 2020, Java 11 is now required for running vscode-java.

Do I need to migrate my projects to Java 11?

NO you don't! Well you should, be we're not here to judge. It is still possible to compile/run Java applications from Java 1.5 to 14, provided the proper java.configuration.runtimes are configured in the user's settings.json.

My Gradle version does not support Java 11

You can set the java.import.gradle.java.home preference to specifically run the Gradle Daemon using a prior version of Java. However, this only works for Gradle >= 4.7.