Extension Pack for Java Auto Config
Overview
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 4 LTSs and latest).
- Includes extensions for de facto standard Java development from Microsoft, Red Hat and others.
GitHub Issues
Open Terminals by Java Version
This extension adds the Java versions available in your current environment to the VS Code terminal profiles dropdown. 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
Specify Default Java Version
The standard Select Default Profile in VSCode only switches the default terminal profile. However, this extension applies the selected profile's Java version to all Java settings (⭐) within the user (global) settings.json
. To specify the Java version individually, edit the following files.
No Build Tools (vscode-java)
(*1) User settings.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 //⭐ default when creating "No build tools" project
}
]
Gradle (vscode-gradle)
(*1) User settings.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
Gradle Toolchain allows you to specify exactly which JDK version to build.
java.toolchain.languageVersion = JavaLanguageVersion.of(23)
Maven (vscode-maven)
(*1) User settings.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>
Maven 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.
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
. However, java.import.gradle.java.home
and maven.executable.path
are always prepend to the PATH
in the terminal.
JDK Auto-Configuration
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
and PATH
- Auto-download Adoptium LTS JDKs, Gradle, Maven if not detected
- Auto-update auto-downloaded JDKs, Gradle, Maven to the latest version
Best Auto-Scan
- OS specific locations: Adoptium, BellSoft, Corretto, Microsoft, Oracle, Red Hat, Semeru, Zulu etc...
- Package Managers: asdf, Chocolatey, jabba, jEnv, Homebrew, IntelliJ, mise, 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) [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 ] |
~~java.home~~ |
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 > Embedded JRE > java.jdt.ls.java.home > JAVA_HOME > PATH > jdk-utils > java.configuration.runtimes default] |
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 (If installed)
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).
Auto-Download Support
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
.
JDK auto-download supports the following platforms:
- Windows x64, ARM Emulation
- Mac 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\ |
Mac |
$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 //⭐
}
],
// 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" //⭐
}
],
Terminal Auto-Configuration
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.
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 (Changing this value will set all ⭐)
"terminal.integrated.defaultProfile.windows": "JavaSE-21 LTS",
"terminal.integrated.automationProfile.windows": {
"path": "cmd"
},
// Terminal Profiles Dropdown
"terminal.integrated.profiles.windows": {
"JavaSE-1.8 LTS": {...},
"JavaSE-11 LTS": {...},
"JavaSE-17 LTS": {
"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 LTS": {
"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"]
}
}
Auto-Default Settings
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).
For Included Extensions
For Optional Extensions (If installed)
Configuration Name |
Original Default |
Auto Default |
JSP Language Support emmet.includeLanguages |
{} |
{"jsp": "html"} |
Thunder Client thunder-client.requestLayout |
Left/Right |
Top/Bottom |
"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
},
Language Pack Auto-Installation
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
or zh-hant
License
Thank you
A big thank you to the developers of VS Code and its extensions.
Included Extensions
The Extension Pack for Java
is required. Other extensions can be disabled or uninstalled according to your preference. 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. Note that uninstalling Extension Pack for Java Auto Config
extension will uninstall all of the following extensions.
-
Code Spell Checker (Street Side Software: GPL)
Spelling checker for source code.
-
(*) Comment Translate (intellsmi: MIT)
This plugin uses the Google Translate API to translate comments for the VS Code programming language.
-
Extension Pack for Java (Microsoft: MIT, Red Hat: EPL) / VS Code Document
Java IntelliSense, debugging, testing, Maven/Gradle support, Lombok and more.
-
Gradle for Java (Microsoft: MIT) / VS Code Document
Manage Gradle Projects, run Gradle tasks and provide better Gradle file authoring experience in VS Code.
-
Indent-Rainbow (oderwat: MIT)
Makes indentation easier to read.
-
(*) Language Pack (Microsoft: MIT) / VS Code Document
A language pack that matches the OS Locale.
-
Live Server (Ritwick Dey: MIT)
Launch a development local Server with live reload feature for static & dynamic pages.
-
Rainbow CSV (mechatroner: MIT)
Highlight CSV and TSV files, Run SQL-like queries.
-
Spring Boot Extension Pack (Broadcom: EPL) / VS Code Document
A collection of extensions for developing Spring Boot applications.
-
Todo Tree (Gruntfuggly: MIT)
Show TODO, FIXME, etc. comment tags in a tree view.
-
Trailing Spaces (Shardul Mahadik: MIT)
Highlight trailing spaces and delete them in a flash!
-
XML (Red Hat: EPL)
XML Language Support by Red Hat (pom.xml etc.).
Recommended Extensions
The following are not included but are very useful extensions. Try to install it if necessary.
-
code-eol 2022 (Jeff Hykin: MIT) / code-eol (sohamkamani: Free)
Display newline characters in your code. (VSCode does not support CR)
-
Checkstyle (ShengChen: GPL) / VS Code Document
Provide real-time feedback about Checkstyle violations and quick fix actions.
-
Error Lens (Phil Hindle: MIT)
Improve highlighting of errors, warnings and other language diagnostics.
-
GistPad (Jonathan Carter: MIT)
Manage your code snippets and developer notes using GitHub Gists and repositories.
-
GlassIt-VSC (hikarin522: MIT)
VS Code Extension to set window to transparent on Windows and Linux platforms.
-
Java TestingPair Opener (gengen0719: Apache)
This is an extension that opens JavaCode's TestingPair with a shortcut-key.
-
JSP Language Support (Samuel Weinhardt: MIT)
JSP syntax highlighting for VS Code.
-
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.
-
Thunder Client (Ranga Vadhineni: Free)
Lightweight Rest API Client for VS Code.
-
Thymeleaf HTML5 Snippets (Lalith Kahatapitiya: GPL)
Most common thymeleaf code snippets for .html file.
-
Thymeleaf Navigation (Stefan Gründel: GPL)
Navigate Thymeleaf 3 fragments.
Recommended Gradle/Maven plugin that supports Tomcat hot deployment.