Skip to content

Feature Request: Set default in java.configuration.runtimes to the workspace environment variable JAVA_HOME #1293

Open

Description

Currently, the default of the Java extension java.configuration.runtimes is used as the default for No Build Tools, but it would be useful to set it to the environment variable JAVA_HOME which is valid for each workspace. The environment variable here is not the terminal, but process.env.JAVA_HOME, which is referenced by extensions such as

  • java.import.gradle.java.home
    Setting > java.jdt.ls.java.home > JAVA_HOME > PATH
  • maven.terminal.customEnv
    Setting > JAVA_HOME
  • java.jdt.ls.java.home
    Setting > Embedded JRE > JDK_HOME > JAVA_HOME > PATH
  • spring-boot.ls.java.home
    Setting > Embedded JRE > JAVA_HOME > PATH
  • rsp-ui.rsp.java.home
    Setting > JDK_HOME > JAVA_HOME> Windows Registry > PATH
  • salesforcedx-vscode-apex.java.home
    Setting > JDK_HOME > JAVA_HOME> Windows Registry > PATH
  • plantuml.java
    Setting > PATH

The goal is to be able to use a different JAVA_HOME for each workspace, independent of the system's JAVA_HOME environment variable. For example:

User settings.json

"java.configuration.runtimes": [
	{
		"name": "JavaSE-17",
		"path": "/path/to/java/17",
		"default": true
	},
	{
		"name": "JavaSE-21",
		"path": "/path/to/java/21",
	}
],

Workspace settings.json (Override default runtime to JavaSE-21)

"java.configuration.runtimes": [
	{
		"name": "JavaSE-21",
		"path": "/path/to/java/21",
		"default": true
	}
],

java.configuration.runtimes is a Red Hat extension, but I am posting it here because I believe it needs to be supported by VSCode itself. It is related to the following issues.
#152806 API: allow an extension to change the environment variables

Activity

  1. github-actions commented on Nov 4, 2025

    @github-actions

    Hi Shinji Kashihara (@cypher256), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    Current state

    • The Red Hat Java extension reads java.configuration.runtimes at machine scope, so you cannot point the default to a workspace‐specific process.env.JAVA_HOME today.

    Workarounds & tracking

    Other references with low confidence

    None

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions