Just install this extension and start Java development right out of the box with zero configuration.
- No need to install JDK, Gradle or Maven, no need to set JAVA_HOME or PATH environment variables.
- Automatically configure, update, and fix multiple Java versions (at least the four latest LTS).
- Includes extensions for de facto standard Java development from Microsoft, Red Hat and others.
GitHub Issues- Microsoft: Extension Pack for Java | Maven | Gradle | Debug | Test | Project Manager | IntelliCode
- Red Hat: Language Support for Java | XML
- Broadcom: Spring Boot Extension Pack | Initializr | Dashboard
This extension adds the Java versions available in your current environment to the VS Code terminal drop-down. Select the Java version you want to use, open terminals, and you can check the complete version with the following commands. The latest versions of gradle and mvn are available, but it is generally recommended to use wrappers (gradlew, mvnw) for each project.
java -version
gradle -v
mvn -v
The Extension Pack for Java Auto Config
has been extended to automatically configure the user (global) settings.json
at startup and apply the Java version selected in Select Default Profile to settings.json (⭐). To specify the Java version individually, edit the following files.
-
No Build Tools (vscode-java)
(*1) Usersettings.json
// Java runtimes common settings "java.configuration.runtimes": [ { "name": "JavaSE-1.8", "path": "C:\\Program Files\\java\\jdk-1.8.0_402", }, { "name": "JavaSE-11", "path": "C:\\Program Files\\java\\jdk-11.0.21", }, { "name": "JavaSE-17", "path": "C:\\Program Files\\java\\jdk-17.0.12" }, { "name": "JavaSE-21", "path": "C:\\Program Files\\java\\jdk-21.0.8", "default": true //⭐ For No Build Tools projects } ]
-
Gradle (vscode-gradle)
(*1) Usersettings.json
(Gradle execution runtime)"java.import.gradle.java.home": "C:\\Program Files\\java\\jdk-21.0.8" //⭐
(*2) Project
build.gradle
(options.release
)def javaVersion = 17 java.sourceCompatibility = javaVersion // Make it recognize to VS Code compileJava.options.release = javaVersion // JEP 247: API validation
Toolchain allows you to specify exactly which JDK version to build. Note that you cannot use the latest Java version without using the toolchains.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
-
Maven (vscode-maven)
(*1) Usersettings.json
(Maven execution runtime)"maven.terminal.customEnv": [ { "environmentVariable": "JAVA_HOME", "value": "C:\\Program Files\\java\\jdk-21.0.8" //⭐ } ]
(*2) Project
pom.xml
(maven.compiler.release
)<properties> <!-- <maven.compiler.source>17</maven.compiler.source> --> <!-- <maven.compiler.target>17</maven.compiler.target> --> <maven.compiler.release>17</maven.compiler.release><!-- JEP 247: API validation --> </properties>
Toolchain allows you to specify exactly which JDK version to build.
(*1) The settings.json
can be overridden by project (workspace).
(*2) The java.configuration.runtimes
that best matches this version will be used. Setting the release
ensures the specified version syntax and api is used regardless of which compiler version actually performs the compilation.
- JEP 182: Retiring javac -source and -target / JEP 247: Compile for Older Platform Versions
- Since Spring Boot 3.1, Maven
<java.version>
value is set to<maven.compiler.release>
. - Enabling Java preview features
The JDK, build tools, terminal and other settings are automatically configured and updated at startup according to the current environment, as shown below. If you want to disable all auto-configuration features, set javaAutoConfig.enabled
to false
.
Automatically configure multiple versions of the JDK and build tools. If there are multiple JDKs of the same version, the latest minor version among them is used. If you installed the JDK manually or encountered a configuration error, restart VS Code or execute Command Palette >Java: Clean Java Language Server Workspace ≫ Reload and delete. These apply to User settings.json
(VS Code global), but can be manually edited to customize them. If you want to customize your settings even further, consider using workspace settings or profiles.
- Auto-fix invalid JDK configuration (e.g.
/foo/jdk-21.0.8/bin
->/foo/jdk-21.0.8
) - Auto-remove configuration entries when JDK uninstalled or version path changed
- Auto-scan from OS specific locations, Package Managers and Toolchains (See next section)
- Auto-detect environment variables
JAVA_HOME
,JDK_HOME
andPATH
- Auto-download Adoptium LTS JDKs, Gradle, Maven if not installed
- Auto-update auto-downloaded JDKs, Gradle, Maven to the latest version
JDK auto-scan targets (Best in the industry)
- OS specific locations: Adoptium, BellSoft, Corretto, Microsoft, Oracle, Red Hat, Semeru, Zulu etc...
- Package Managers: asdf, Chocolatey, jabba, jEnv, Homebrew, IntelliJ, Scoop, SDKMAN, vfox etc...
- Toolchains: Gradle jdks directory, Maven toolchains.xml
- Own Support: Windows
C:\Java\*
,D:\Java\*
(e.g.C:\Java\jdk-21.0.8
)
The feature automatically fixes errors such as
- Java Language Server requires a JDK xx+ to launch itself.
- This setting is deprecated, please use 'java.jdt.ls.java.home' instead.
- Invalid runtime for JavaSE-xx: The path points to a missing or inaccessible folder
- The java.jdt.ls.java.home variable defined in Visual Studio Code settings points to a missing or inaccessible folder
For Included Extensions
Configuration Name | Configured Value [Precedence] |
---|---|
Language support for Java | |
java.configuration.runtimes (Issues) ⭐ default |
Set all detected and downloaded JDKs (default: Latest LTS) [ settings.json > JAVA_HOME ] |
java.jdt.ls.java.home (Issues) 🛠️ |
Remove setting if Red Hat embedded JRE exists [ settings.json > Embedded JRE > JDK_HOME > JAVA_HOME > PATH ] |
Remove as it has been replaced by java.jdt.ls.java.home |
|
Spring Boot Tools | |
spring-boot.ls.java.home (Issues) 🛠️ |
Remove setting if Red Hat embedded JRE exists [ settings.json > Embedded JRE > JAVA_HOME > PATH ] |
Gradle for Java | |
java.import.gradle.java.home (Issues) ⭐ |
Set latest LTS JDK if unset [ settings.json > java.jdt.ls.java.home > JAVA_HOME > PATH ] |
java.import.gradle.home (Issues) |
Set auto-downloaded gradle if unset [ gradlew > settings.json > PATH > GRADLE_HOME ] |
Maven for Java | |
maven.terminal.customEnv (Issues) ⭐ |
Set latest LTS JDK if unset [ settings.json > JAVA_HOME ] |
maven.executable.path (Issues) 📝 |
Set auto-downloaded maven if unset (If you want to use mvnw , set "" manually)[ settings.json > mvnw > PATH ] |
For Optional Extensions
Configuration Name | Configured Value [Precedence] |
---|---|
IBM Z Open Editor zopeneditor.JAVA_HOME (Issues) 🛠️📝 |
Set previous LTS if unset [ settings.json > JAVA_HOME > PATH ] |
PlantUML plantuml.java (Issues) 🛠️ |
Set stable LTS if unset [ settings.json > PATH ] |
Runtime Server Protocol UI rsp-ui.rsp.java.home (Issues) 🛠️ |
Set stable LTS if unset [ settings.json > JDK_HOME > JAVA_HOME > Windows Registry > PATH ] |
Salesforce Extension Pack salesforcedx-vscode-apex.java.home (Issues) 🛠️ |
Set previous LTS if unset [ settings.json > JDK_HOME > JAVA_HOME > Windows Registry > PATH ] |
Scala (Metals) metals.javaHome (Issues) 🛠️ |
Set previous LTS if unset [ settings.json > JAVA_HOME > Windows Registry > PATH ] |
⭐ The Java version specified in Select Default Profile is set.
🛠️ The language server runtime used by VS Code extensions. Not for building or running projects.
📝 This setting cannot be overridden per workspace (project).
Automatic download is enabled if the extensions.autoUpdate configuration is NOT false
. Java downloads multiple versions, but Gradle/Maven downloads only the latest version. If you use an older version of Gradle/Maven due to compatibility issues, please introduce gradlew
(Compatibility) or mvnw
(Compatibility) in your project or manually set java.import.gradle.home
or maven.executable.path
in settings.json
.
- Adoptium JDK - Latest LTS 4 versions if not installed (VS Code supported versions)
- Gradle - Latest version
- Maven - Latest version
JDK auto-download supports the following platforms:
- Windows x64, ARM Emulation
- macOS x64, aarch64
- Linux x64, aarch64
It is saved in the following location.
OS | Extension global storage location |
---|---|
Windows | %APPDATA%\Code\User\globalStorage\pleiades.java-extension-pack-jdk\ |
macOS | $HOME/Library/Application Support/Code/User/globalStorage/pleiades.java-extension-pack-jdk/ |
Linux | $HOME/.config/Code/User/globalStorage/pleiades.java-extension-pack-jdk/ |
Command Palette >Preferences: Open User Settings (JSON)
// Project Runtimes (multiple versions)
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8", // Adoptium (Auto-download)
"path": "C:\\Users\\<UserName>\\AppData\\Roaming\\Code\\User\\globalStorage\\pleiades.java-extension-pack-jdk\\java\\8"
},
{
"name": "JavaSE-11", // Corretto (Auto-scan)
"path": "C:\\Program Files\\Amazon Corretto\\jdk11.0.18_10"
},
{
"name": "JavaSE-17", // Oracle (Auto-scan)
"path": "C:\\Program Files\\java\\jdk-17.0.12"
},
{
"name": "JavaSE-21", // Adoptium (Auto-scan)
"path": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot",
"default": true // Runtime to use for No build tools projects
}
],
// Gradle Daemon Java Runtime
"java.import.gradle.java.home": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot",
// Maven Environment Variables (for GUI context menu)
"maven.terminal.customEnv": [
{
"environmentVariable": "JAVA_HOME",
"value": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot"
}
],
The terminal dropdown items by Java version are automatically created based on the "java.configuration.runtimes" above. You can easily open a terminal by selecting the Java version from command >Terminal: Create New Terminal (With Profile) or Terminal (Ctrl + `) ≫ Profiles dropdown. Besides java
, gradle
and mvn
commands can also be used. The configured environment variables have no effect outside the terminal, so the system and OS user environment remain clean. The JAVA_HOME
and PATH
in the auto-configured terminal configuration will always be overridden from the configured runtimes, so if you want to customize it, copy the terminal configuration entry and create a new one.
Configuration Name | Configured Value [Original Default] |
---|---|
terminal.integrated.env.windows (Issues) Windows only ⭐ |
Set latest LTS if unset [None] |
terminal.integrated.defaultProfile.{platform} (Issues) |
Set latest LTS runtime name (e.g. JavaSE-21 )[Windows: cmd , Mac:zsh , Linux:bash ] |
terminal.integrated.automationProfile.windows (Issues) Windows only |
"path": "cmd" [null] Suppress error: 'Incorrect parameter format -/d' |
terminal.integrated.profiles.{platform} (Issues) ⭐ Mac: zsh , Linux:bash |
Set configured runtimes to terminal [None] |
terminal.integrated.enablePersistentSessions (Issues) |
false [ true ] |
terminal.integrated.tabs.hideCondition (Issues) |
never [ singleTerminal ] |
java.test.config > vmArgs (Issues) Windows only |
-Dstdout.encoding=UTF-8 , -Derrout.encoding=UTF-8 [ undefined ] |
Command Palette >Preferences: Open User Settings (JSON)
// Terminal Default Environment Variables
"terminal.integrated.env.windows": {
"PATH": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot\\bin;${env:PATH}",
"JAVA_HOME": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot"
},
// Terminal Default Profile
"terminal.integrated.defaultProfile.windows": "JavaSE-21",
"terminal.integrated.automationProfile.windows": {
"path": "cmd"
},
// Terminal Profiles Dropdown
"terminal.integrated.profiles.windows": {
"JavaSE-1.8": {...},
"JavaSE-11": {...},
"JavaSE-17": {
"overrideName": true,
"env": {
"PATH": "C:\\Program Files\\java\\jdk-17.0.12\\bin;${env:PATH}",
"JAVA_HOME": "C:\\Program Files\\java\\jdk-17.0.12"
},
"path": "cmd"
},
"JavaSE-21": {
"overrideName": true,
"env": {
"PATH": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot\\bin;${env:PATH}",
"JAVA_TOOL_OPTIONS": "-Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8", // Windows
"JAVA_HOME": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot"
},
"path": "cmd",
// For Windows, auto-configured Java 19+ terminals are set to `chcp 65001`.
"args": [
"/k",
"chcp",
"65001"
]
}
}
Entries that do not have the following configuration in the user settings are automatically set to the default values of Extension Pack for Java Auto Config
. To prevent automatic setting, set the Original Default value below. Note that a debug run is required to enable Hot Code Replace (Hot Deploy).
Configuration Name | Original Default | Auto Default |
---|---|---|
editor.codeActionsOnSave | {} |
See below |
editor.linkedEditing (like Auto Rename Tag) | false |
true |
editor.minimap.enabled | true |
false |
editor.rulers | [] |
See below |
editor.unicodeHighlight.includeComments | inUntrustedWorkspace |
true |
emmet.variables > lang | en |
OS locale |
workbench.colorCustomizations | {} |
See below |
workbench.editor.revealIfOpen | false |
true |
workbench.tree.indent | 8 |
20 |
files.eol (For Windows) | auto |
\n |
[bat] > files.eol |
auto |
\r\n |
Language support for Java | ||
java.configuration.detectJdksAtStart | true |
false |
java.configuration.updateBuildConfiguration | interactive |
automatic |
java.sources.organizeImports.staticStarThreshold | 99 |
1 |
Debugger for Java | ||
java.debug.settings.hotCodeReplace | manual |
auto |
Code Spell Checker | ||
cSpell.diagnosticLevel | Information |
Hint |
Trailing Spaces | ||
trailing-spaces.includeEmptyLines | true |
false |
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.rulers": [ // RGBA for transparency
{
"column": 80,
"color": "#00FF0010"
},
{
"column": 100,
"color": "#BDB76B15"
},
{
"column": 120,
"color": "#FA807219"
},
],
"workbench.colorCustomizations": {
"[Default Dark Modern]": {
"tab.activeBorderTop": "#00FF00",
"tab.unfocusedActiveBorderTop" : "#00FF0088",
"textCodeBlock.background": "#00000055", // Markdown preview code block
},
"editor.wordHighlightStrongBorder": "#FF6347", // Write-access
"editor.wordHighlightBorder": "#FFD700", // Read-access
"editor.selectionHighlightBorder": "#A9A9A9" // Double click selection
},
The language pack corresponding to the OS locale is installed at the first startup.
cs
,de
,es
,fr
,it
,ja
,ko
,pl
,ru
,tr
,zh-hans
orzh-hant
- MIT (c) 2023 Shinji Kashihara (cypher256) @ WILL
- Adoptium JDK: https://adoptium.net/docs/faq/#_is_temurin_free_to_use
A big thank you to the developers of VS Code and its extensions.
The Extension Pack for Java
is required. Other extensions can be disabled or uninstalled according to your preference. Note that uninstalling Extension Pack for Java Auto Config
extension will uninstall all of the following extensions. If you want to set up extensions and configurations by development language, consider Profile. (*) indicates that it will be installed if available in that environment at first startup.
-
Extension Pack for Java (Microsoft: MIT, Red Hat: EPL) / VS Code Document
Java IntelliSense, debugging, testing, Maven/Gradle support, Lombok and more. -
Spring Boot Extension Pack (Broadcom: EPL) / VS Code Document
A collection of extensions for developing Spring Boot applications. -
Gradle for Java (Microsoft: MIT) / VS Code Document
Manage Gradle Projects, run Gradle tasks and provide better Gradle file authoring experience in VS Code. -
XML (Red Hat: EPL)
XML Language Support by Red Hat (pom.xml etc.). -
Code Spell Checker (Street Side Software: GPL)
Spelling checker for source code. -
Todo Tree (Gruntfuggly: MIT)
Show TODO, FIXME, etc. comment tags in a tree view. -
Live Server (Ritwick Dey: MIT)
Launch a development local Server with live reload feature for static & dynamic pages. -
Trailing Spaces (Shardul Mahadik: MIT)
Highlight trailing spaces and delete them in a flash! -
Indent-Rainbow (oderwat: MIT)
Makes indentation easier to read. -
Rainbow CSV (mechatroner: MIT)
Highlight CSV and TSV files, Run SQL-like queries. -
(*) Comment Translate (intellsmi: MIT)
This plugin uses the Google Translate API to translate comments for the VS Code programming language. -
(*) Language Pack (Microsoft: MIT) / VS Code Document
A language pack that matches the OS Locale.
The following are not included but are very useful extensions. Try to install it if necessary.
-
Thunder Client (Ranga Vadhineni: Free)
Lightweight Rest API Client for VS Code. -
Error Lens (Phil Hindle: MIT)
Improve highlighting of errors, warnings and other language diagnostics. -
SonarLint (SonarSource: GPL) / VS Code Document
Detect and fix quality issues as you write code in C, C++, Java, JavaScript, PHP, Python, HTML and TypeScript. -
Checkstyle (ShengChen: GPL) / VS Code Document
Provide real-time feedback about Checkstyle violations and quick fix actions. -
Thymeleaf HTML5 Snippets (Lalith Kahatapitiya: GPL)
Most common thymeleaf code snippets for .html file. -
Thymeleaf Navigation (Stefan Gründel: GPL)
Navigate Thymeleaf 3 fragments. -
Java Server Pages (JSP) (Samuel Weinhardt: MIT)
JSP syntax highlighting for VS Code. -
Community Server Connectors (Red Hat: EPL) / VS Code Document
This extension can start, stop, publish, and control servers such as Apache Felix, Karaf, and Tomcat.. -
GlassIt-VSC (hikarin522: MIT)
VS Code Extension to set window to transparent on Windows and Linux platforms. -
GistPad (Jonathan Carter: MIT)
Manage your code snippets and developer notes using GitHub Gists and repositories.
Recommended Gradle/Maven plugin that supports Tomcat hot deployment.
- Gradle: Gretty Plugin
- Maven: Codehaus Cargo Plugin