Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Java Extension Pack Auto Config

GitHub Sponsor

If JDK, Gradle and Maven are already installed they will be used, otherwise they will be automatically installed in VS Code user directory. Environment variables such as JAVA_HOME and PATH do not need to be set. It also comes pre-included with extensions that most Java developers need, such as Spring Boot and Lombok, so you can start developing right out of the box with zero configuration.


Method 1: VS Code Web Marketplace

  1. Click Install on the Marketplace web page in web browser
  2. Click Install on README opened in VS Code

Method 2: Extensions Sidebar

  1. Open Extensions sideBar (Ctrl/CMD + Shift + X) in VS Code
  2. Search for auto config
  3. Click Install

Method 3: Quick Pick

  1. Open Quick Pick (Ctrl/CMD + P) in VS Code, paste the following command, and press enter.
    ext install

Method 4: Command Line

  1. Install from the command line.
    code --install-extension

Getting Started

Just install this extension and the JDK is auto-configured. Let's run the Java code right away!

  1. Open command palette (F1 or Ctrl/Cmd + Shift + P) >Java: Create Java Project...
  2. No build tools ≫ Specify project parent directory ≫ Enter new project name (e.g. HelloWorld)
  3. Open src/ ≫ Press F5 to run

Hello World

Check Version

Select the Java version from the dropdown in the VS Code terminal and execute the following commands. The terminal Java dropdown items are automatically created by this extension (Java 21 support). The latest versions of gradle and mvn are available, but wrappers (gradlew, mvnw) are recommended.

java -version
gradle -v
mvn -v

Terminal Java Dropdown

Specify Project Java Version

The versions defined in java.configuration.runtimes are available.
(Enabling Java preview features)

Project Type Configuration
No build tools settings.json > java.configuration.runtimes > default: true
Gradle build.gradle > java > sourceCompatibility
Maven pom.xml > properties > maven.compiler.source/target
(Spting Boot: java.version)


This extension has no specific settings or commands. As shown below, the JDK, build tools, terminal and other settings are automatically configured at start-up according to the current environment. If you are not interested in how it is auto-configured, you do not need to read the following.

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 manually install or update the JDK and want to force update the configuration of VS Code, restart VS Code or execute >Developer: Reload Window from the command palette (F1 or Ctrl/Cmd + Shift + P). 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.

  1. Auto-fix invalid JDK configuration (e.g. /java/bin -> /java)
  2. Auto-remove configuration entries when JDK uninstalled or version path changed
  3. Auto-scan from packages SDKMAN, Homebrew, jEnv, jabba, ASDF, Gradle, Scoop, Chocolatey, IntelliJ etc...
  4. Auto-scan from installations Adoptium, BellSoft, Corretto, Microsoft, Oracle, Red Hat, Semeru, Zulu etc...
  5. Auto-detect environment variables JAVA_HOME, JDK_HOME and PATH
  6. Auto-download LTS JDKs, Gradle, Maven if not installed
  7. Auto-update auto-downloaded JDKs, Gradle, Maven to the latest version

The feature automatically fixes errors such as:

  • Java Language Server requires a JDK xx+ to launch itself.
  • This setting is deprecated, please use '' instead.
  • Invalid runtime for JavaSE-xx: The path points to a missing or inaccessible folder
  • The variable defined in Visual Studio Code settings points to a missing or inaccessible folder

Configuration Name Configured Value (Priority Order)
Language support for Java
java.home Delete due to deprecated entry
Set all major JDKs scanned, detected, and downloaded
(Setting > JAVA_HOME)
(*2) Set stable LTS if unset, Fix if unsupported older version
(Setting > Embedded JRE > JDK_HOME > JAVA_HOME > PATH)
Spring Boot Tools
(*2) Set stable LTS if unset, Fix if unsupported older version
(Setting > JAVA_HOME > PATH)
Gradle for Java
(*3) Set default if unset
(Setting >
Set latest gradle if not in PATH environment variable
(gradlew > Setting > PATH > GRADLE_HOME)
Maven for Java
(*3) Set default if JAVA_HOME environment variable unset
(Setting > JAVA_HOME)
Set latest maven if not in PATH environment variable
(Setting > mvnw > PATH)
Runtime Server Protocol UI (No extension included)
(*2) Set stable LTS if unset, Fix if unsupported older version
(Setting > JDK_HOME > JAVA_HOME> Windows Registry > PATH)

(*1) The language server runtime used by VS Code extensions. Not for building or running projects.
(*2) Usually the same version of the JDK as the Red Hat Java extension Embedded JRE.
(*3) The path in the entry marked as default:true in java.configuration.runtimes.

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.

  • Adoptium JDK - Latest LTS 4 versions if not installed (VS Code supported versions)
  • Gradle - Latest version if not in PATH environment variable
  • Maven - Latest version if not in PATH environment variable

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\\
macOS $HOME/Library/Application Support/Code/User/globalStorage/
Linux $HOME/.config/Code/User/globalStorage/

e.g. Auto-configured User settings.json

Command Palette >Preferences: Open User Settings (JSON)

// JDT Language Server
"": "c:\\Program Files\\java\\jdk-17.0.6",
// ST4 Language Server
"": "c:\\Program Files\\java\\jdk-17.0.6",
// Project Runtimes (multiple versions)
"java.configuration.runtimes": [
    "name": "JavaSE-1.8", // Adoptium (Auto-download)
    "path": "c:\\Users\\<UserName>\\AppData\\Roaming\\Code\\User\\globalStorage\\\\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.6",
    "default": true // Runtime to use for No build tools projects
    "name": "JavaSE-19", // JAVA_HOME (Auto-detect)
    "path": "d:\\jdk\\19"
    "name": "JavaSE-20", // Adoptium (Auto-scan)
    "path": "c:\\Program Files\\Eclipse Adoptium\\jdk-"
// Gradle Daemon
"": "c:\\Program Files\\java\\jdk-17.0.6",
// Maven Default Environment Variables
"maven.terminal.customEnv": [
    "environmentVariable": "JAVA_HOME", // Required for mvn command
    "value": "c:\\Program Files\\java\\jdk-17.0.6"

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.

Configuration Name Configured Value (Original Default)
Set default if JAVA_HOME environment variable unset
(Setting > JAVA_HOME)
Set Command Prompt if unset on Windows
Set configured runtimes to terminal

A non-existent rcfile is specified so that JAVA_HOME and PATH are not overwritten at shell startup. If necessary, manually create the following rcfile.

OS Default Shell rcfile Location
Windows cmd -
macOS zsh ~/.zsh_jdkauto/.zshrc
Linux or WSL bash ~/.bashrc_jdkauto

e.g. Auto-configured User settings.json

Command Palette >Preferences: Open User Settings (JSON)

// Terminal Default Environment Variables
"": {
  "JAVA_HOME": "c:\\Program Files\\java\\jdk-17.0.6",
  "PATH": "c:\\Program Files\\java\\jdk-17.0.6\\bin;${env:PATH}"
// Terminal Default Profile
"": "Command Prompt",
// Terminal Profiles Dropdown
"": {
  "JavaSE-1.8": {
      "path": "cmd",
      "env": {
          "JAVA_HOME": "c:\\Users\\<UserName>\\AppData\\Roaming\\Code\\User\\globalStorage\\\\java\\8",
          "PATH": "c:\\Users\\<UserName>\\AppData\\Roaming\\Code\\User\\globalStorage\\\\java\\8\\bin;${env:PATH}"
      "overrideName": true
  "JavaSE-11": {
      "path": "cmd",
      "env": {
          "JAVA_HOME": "c:\\Program Files\\Amazon Corretto\\jdk11.0.18_10",
          "PATH": "c:\\Program Files\\Amazon Corretto\\jdk11.0.18_10\\bin;${env:PATH}"
      "overrideName": true
  "JavaSE-17": {

Auto-default Settings

Entries that do not have the following configuration in the user settings are automatically set to the default values of Auto Config Java. 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.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

Highlight Default Settings

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


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 this 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 (VMWare: 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.

Related 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 (Alexander: Unknown)
    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.
  • Coverage Gutters (ryanluker: MIT)
    Display test coverage generated by lcov or xml - works with many languages.
  • thymeleaf (Juha Hinkula: Unknown)
    Thymeleaf snippets.
  • Java Server Pages (JSP) (Patrik Thorsson: MIT)
    (unmaintained) JSP language support for Visual Studio Code, ported from TextMate's JSP bundle.
  • 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.
  • GitHub Copilot (GitHub: Subscription) / VS Code Document
    Your AI pair programmer.
  • GitHub Copilot Chat (GitHub: Subscription)
    AI chat features powered by Copilot.

For command line installation:

code --install-extension rangav.vscode-thunder-client
code --install-extension usernamehw.errorlens
code --install-extension SonarSource.sonarlint-vscode
code --install-extension shengchen.vscode-checkstyle
code --install-extension ryanluker.vscode-coverage-gutters
code --install-extension juhahinkula.thymeleaf
code --install-extension pthorsson.vscode-jsp
code --install-extension redhat.vscode-community-server-connector
code --install-extension s-nlf-fh.glassit
code --install-extension vsls-contrib.gistfs
code --install-extension GitHub.copilot
code --install-extension GitHub.copilot-chat