Skip to content

Javac‐based compilation support

Roland Grunberg edited this page Nov 4, 2024 · 2 revisions

As of version 1.36.0, vscode-java has experimental support for Javac-based compilation. Instead of compiling projects with Eclipse JDT's ECJ compiler, it uses javac while satisfying the underlying models that would have relied on ECJ. This means we continue to provide all features of the language server as before.

Requirements

  • The javac-based compiler currently requires a JDK 23 be configured to start the language server. As a result, users should set java.jdt.ls.java.home to the folder containing the JDK 23 installation.
  • Set java.jdt.ls.javac.enabled to on (Default is off)

You may be prompted to restart VS Code for the changes to take effect, but subsequent project imports will occur through javac.

Extra Features

While java.jdt.ls.javac.enabled handles building and most other features, we have created a separate option java.completion.engine (Default is ecj), that allows configuring which option (ecj, or dom) is used for the completion engine. With the dom option, the completion engine consumes the model generated by the javac-based compilation.