Skip to content

extension does not correctly detect java home correctly without environment variable set #374

@xoviat

Description

@xoviat

This is more of an annoyance rather than a showstopper. However, having to update JAVA_HOME is annoying because my JAVA is updated automatically. Here's what I know:

  • Upon installing the extension, I received a message that JAVA_HOME was not detected.
  • Investigating further, vscode-xml appears to use node-find-java version 0.2 to find JAVA home, when JAVA home is not set. This behavior is correct from my POV:

findJavaHome({ allowJre: true }, function (err, home) {
if (err){
openJDKDownload(reject, 'Java runtime could not be located.');
}
else {
resolve(home);
}
});

  • Investigating further, it appears to look in JavaSoft for JAVA_HOME (this is version 0.2, which is in the requirements):

https://github.com/jsdevel/node-find-java-home/blob/1f3dc4e5186dd434859ff6fffb0679feb1e47848/index.js#L61-L65

    if(options.allowJre){
      possibleKeyPaths = possibleKeyPaths.concat([
      "SOFTWARE\\JavaSoft\\Java Runtime Environment",
      ]);
    }

Here is the structure of my registry:

image

Yet, I still received this error message:

image

Adding this directly to user settings appears to resolve the problem:

image

The question is why this error happened, given that the extension should have found JAVA_HOME by itself. I am not currently set-up to debug vscode extensions, but I may tackle this if I have time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions