javavscode icon indicating copy to clipboard operation
javavscode copied to clipboard

Suport environment variables in `jdk.project.jdkhome` settings

Open balthild opened this issue 8 months ago • 2 comments

I use nix to manage dev environments, so there's no simple and predictable java home paths. The paths are subject to change each time I update the packages. Therefore, I wish to have a way setting the jdk path from a specific environment veriable.

There's a standard syntax in vscode to do this, i.e.

{
  "jdk.project.jdkhome": "${env:JAVA_HOME_PROJECT}"`
}

However, It is not substituted in config.json out of the box. Therefore, extensions need to do it by themselves, e.g. https://github.com/DominicVonk/vscode-variables.

balthild avatar Mar 20 '25 02:03 balthild

Hey @balthild, Thanks for using our extension. As mentioned in the README, we currently read a few environment variables to set the JDK home. As a workaround, you can use these for now, but we plan to extend support for VSCode's environment variable syntax in the future.

Achal1607 avatar Mar 25 '25 14:03 Achal1607

This doesn't work when the language server and the project need to use different JDKs.

balthild avatar Mar 25 '25 15:03 balthild