Easily switch between different JDK and Maven versions on a per-workspace basis.
Features
Switch Workspace JDK: Change the JDK version for your current workspace.
Switch Workspace Maven: Change the Maven version for your current workspace.
Auto-discovery: Automatically discovers installed JDKs and Mavens on your system.
Terminal Integration: Configures integrated terminals to use the selected JDK and Maven versions (JAVA_HOME, M2_HOME, and PATH).
Automatic Configuration: Updates settings for popular Java-related extensions.
Usage
Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
Type Java Switcher to see the available commands.
Select Java Switcher: Switch Workspace JDK to choose a JDK version.
Select Java Switcher: Switch Workspace Maven to choose a Maven version.
The extension will update your workspace settings.json file with the selected paths.
Configuration
This extension is designed to be zero-config. It works by dynamically updating your VS Code settings when you switch versions.
Extension-Managed Settings
When you switch versions, this extension will set the following configuration in your workspacesettings.json:
javaSwitcher.java.home: Stores the path of the selected JDK.
javaSwitcher.maven.home: Stores the path of the selected Maven installation.
Automatically Updated Settings
Based on your selection, the extension will automatically update the following settings for other popular extensions to ensure a consistent environment:
For JDK selection:
java.jdt.ls.java.home (for Red Hat's Java extension)
spring-boot.ls.java.home (for VMware's Spring Boot extension)
java.import.gradle.java.home (for Red Hat's Java extension)
zopeneditor.JAVA_HOME (for IBM's Z Open Editor)
plantuml.java (for Jebbs' PlantUML extension)
rsp-ui.rsp.java.home (for Red Hat's RSP UI extension)