microsoft / microsoft/vscode-java-pack
Feature Request: Set `default` in `java.configuration.runtimes` to the workspace environment variable JAVA_HOME
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 352
- Forks
- 166
- Avg merge
- 17h 47m
- Merged PRs (30d)
- 32
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 > PATHmaven.terminal.customEnv
Setting > JAVA_HOMEjava.jdt.ls.java.home
Setting > Embedded JRE > JDK_HOME > JAVA_HOME > PATHspring-boot.ls.java.home
Setting > Embedded JRE > JAVA_HOME > PATHrsp-ui.rsp.java.home
Setting > JDK_HOME > JAVA_HOME> Windows Registry > PATHsalesforcedx-vscode-apex.java.home
Setting > JDK_HOME > JAVA_HOME> Windows Registry > PATHplantuml.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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the related VS Code API issue #152806 and the workspace and user settings examples in this issue. Done means determining whether workspace process.env.JAVA_HOME can override the default Java runtime independently of the system environment, with the behavior applying to the listed Java-related settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100