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 the four latest LTS).
- 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 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
Specify Project Java Version
The user (global) settings.json
is auto-configured at startup by Extension Pack for Java Auto Config
. However, if you want to customize it, you can edit that file.
Project JDKs common settings (vscode-java)
(*1) User settings.json
"java.configuration.runtimes": [
{
"name": "JavaSE-17",
"path": "C:\\Program Files\\java\\jdk-17.0.12",
"default": true // Runtime to use for No Build Tools projects
},
{
"name": "JavaSE-21",
"path": "C:\\Program Files\\java\\jdk-21.0.8"
}
]
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 // Legacy option for VS Code
compileJava.options.release = javaVersion // JEP 247: API validation
👉Toolchain allows you to specify exactly which JDK version to build. It's very simple, just specify it as shown below.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
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>
👉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
.
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 installed
- Auto-update auto-downloaded JDKs, Gradle, Maven to the latest version
JDK auto-scan targets
- OS specific locations: Adoptium, BellSoft, Corretto, Microsoft, Oracle, Red Hat, Semeru, Zulu etc...
- Package Managers: SDKMAN, Homebrew, jEnv, jabba, ASDF, Scoop, Chocolatey, IntelliJ 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
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 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
- 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"
}
],
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
"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_HOME": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.8-hotspot"
},
"path": "cmd",
// For Windows, auto-configured Java 18 or later 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).
"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. 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.
Recommended Extensions
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.
-
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.