Java Language Support for Visual Studio Code
Provides Java ™ language support via Eclipse ™ JDT Language Server, which utilizes Eclipse ™ JDT, M2Eclipse and Buildship.
win32-x64, win32-arm64, darwin-x64, darwin-arm64, linux-x64, linux-arm64.Ctrl+Shift+v (Cmd+Shift+v on Mac).To launch and debug your Java programs, it's recommended you install Java Debug Extension for Visual Studio Code.
See the changelog for the latest release. You might also find useful information in the project Wiki.
Now that Java extension will publish platform specific versions, it will embed a JRE for supported platforms such as win32-x64, win32-arm64, linux-x64, linux-arm64, darwin-x64, darwin-arm64. The embedded JRE is used to launch the Language Server for Java. Users are only responsible for configuring Project JDKs to compile your Java projects.
The following part is only kept for the universal version without embedded JRE.
The tooling JDK will be used to launch the Language Server for Java. And by default, will also be used to compile your projects. Java 21 is the minimum required version.
The path to the Java Development Kit can be specified by thejava.jdt.ls.java.homesetting in VS Code settings (workspace/user settings). If not specified, it is searched in the following order until a JDK meets current minimum requirement.
- the
JDK_HOMEenvironment variable- the
JAVA_HOMEenvironment variable- on the current system path
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-25",
"path": "/path/to/jdk-25",
"default": true
},
,
{
"name": "JavaSE-26",
"path": "/path/to/jdk-26",
"default": true
},
]The default runtime will be used when you open standalone Java files.
The following commands are available:
Switch to Standard Mode: switches the Java Language Server to Standard mode. This command is only available when the Java Language Server is in LightWeight mode.Java: Reload Projects (Shift+Alt+U): It forces project configuration / classpath updates (eg. dependency changes or Java compilation level), according to the project build descriptor.Java: Import Java Projects into Workspace: detects and imports all the Java projects into the Java Language Server workspace.Java: Open Java Language Server Log File: opens the Java Language Server log file, useful for troubleshooting problems.Java: Open Java Extension Log File: opens the Java extension log file, useful for troubleshooting problems.Java: Open All Log Files: opens both the Java Language Server log file and the Java extension log file.Java: Force Java Compilation (Shift+Alt+B): manually triggers compilation of the workspace.Java: Rebuild Projects: manually triggers a full build of the selected projects.Java: Open Java Formatter Settings: opens the Eclipse formatter settings. Creates a new settings file if none exists.Java: Clean Java Language Server Workspace: cleans the Java language server workspace.Java: Attach Source: attaches a jar/zip source to the currently opened binary class file. This command is only available in the editor context menu.Java: Add Folder to Java Source Path: adds the selected folder to its project source path. This command is only available in the file explorer context menu and only works for unmanaged folders.Java: Remove Folder from Java Source Path: removes the selected folder from its project source path. This command is only available in the file explorer context menu and only works for unmanaged folders.Java: List All Java Source Paths: lists all the Java source paths recognized by the Java Language Server workspace.Java: Show Build Job Status: shows the Java Language Server job status in Visual Studio Code terminal.Java: Go to Super Implementation: goes to the super implementation for the current selected symbol in editor.Java: Restart Java Language Server: restarts the Java language server.The following settings are supported:
java.home : Deprecated, please use 'java.jdt.ls.java.home' instead. Absolute path to JDK home folder used to launch the Java Language Server. Requires VS Code restart.java.jdt.ls.lombokSupport.enabled: Whether to enable lombok support. Defaults to true.java.jdt.ls.vmargs : Extra VM arguments used to launch the Java Language Server. Requires VS Code restart.java.jdt.ls.mavenProjectCacheSize: Specifies the size of the in-memory Maven project cache to use. Increasing the project cache size will help load multi-module projects and monorepos faster, but will result in a significant increase in memory usage.java.errors.incompleteClasspath.severity : Specifies the severity of the message when the classpath is incomplete for a Java file. Supported values are ignore, info, warning, error.java.trace.server : Traces the communication between VS Code and the Java language server.java.configuration.updateBuildConfiguration : Specifies how modifications on build files update the Java classpath/configuration. Supported values are disabled (nothing happens), interactive (asks about updating on every modification), automatic (updating is automatically triggered).java.configuration.maven.userSettings : Path to Maven's user settings.xml.java.configuration.checkProjectSettingsExclusions: Deprecated, please use 'java.import.generatesMetadataFilesAtProjectRoot' to control whether to generate the project metadata files at the project root. And use 'files.exclude' to control whether to hide the project metadata files from the file explorer. Controls whether to exclude extension-generated project settings files (.project, .classpath, .factorypath, .settings/) from the file explorer. Defaults to false.java.referencesCodeLens.enabled : Enable/disable the references code lenses.java.referencesCodeLens.includeFields : Enable/disable the references code lens for fields.java.implementationCodeLens : Enable/disable the implementations code lens for the provided categories.java.signatureHelp.enabled : Enable/disable signature help support (triggered on ().java.signatureHelp.description.enabled : Enable/disable to show the description in signature help. Defaults to false.java.contentProvider.preferred : Preferred content provider (see 3rd party decompilers available in vscode-java-decompiler).java.import.exclusions : Exclude folders from import via glob patterns. Use ! to negate patterns to allow subfolders imports. You have to include a parent directory. The order is important.java.import.gradle.enabled : Enable/disable the Gradle importer.java.import.gradle.wrapper.enabled: Use Gradle from the 'gradle-wrapper.properties' file. Defaults to true.java.import.gradle.version: Use Gradle from the specific version if the Gradle wrapper is missing or disabled.java.import.gradle.home: Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.java.import.gradle.arguments: Arguments to pass to Gradle.java.import.gradle.jvmArguments: JVM arguments to pass to Gradle.java.import.gradle.user.home: setting for GRADLE_USER_HOME.java.import.gradle.offline.enabled: Enable/disable the Gradle offline mode. Defaults to false.java.import.maven.enabled : Enable/disable the Maven importer.java.autobuild.enabled : Enable/disable the 'auto build'.java.maxConcurrentBuilds: Set max simultaneous project builds.java.completion.enabled : Enable/disable code completion support.java.completion.guessMethodArguments : Specify how the arguments will be filled during completion. Defaults to auto.auto: Use off only when using Visual Studio Code - Insiders, other platform will defaults to insertBestGuessedArguments.off: Method arguments will not be inserted during completion.insertParameterNames: The parameter names will be inserted during completion.insertBestGuessedArguments: The best guessed arguments will be inserted during completion according to the code context.java.completion.filteredTypes: Defines the type filters. All types whose fully qualified name matches the selected filter strings will be ignored in content assist or quick fix proposals and when organizing imports. For example 'java.awt.*' will hide all types from the awt packages.java.completion.favoriteStaticMembers : Defines a list of static members or types with static members.java.completion.importOrder : Defines the sorting order of import statements.java.format.enabled : Enable/disable the default Java formatter.java.format.settings.url : Specifies the url or file path to the Eclipse formatter xml settings.java.format.settings.profile : Optional formatter profile name from the Eclipse formatter settings.java.format.comments.enabled : Includes the comments during code formatting.java.format.onType.enabled : Enable/disable on-type formatting (triggered on ;, } or <return>).java.foldingRange.enabled: Enable/disable smart folding range support. If disabled, it will use the default indentation-based folding range provided by VS Code.java.maven.downloadSources: Enable/disable download of Maven source artifacts as part of importing Maven projects.java.maven.updateSnapshots: Force update of Snapshots/Releases. Defaults to false.java.codeGeneration.hashCodeEquals.useInstanceof: UseNo open issues yet, or sync has not completed.