Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cypher256 opened this issue Feb 20, 2024 · 0 comments

Comments

@cypher256
Copy link

cypher256 commented Feb 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant