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

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

Closed
xoviat opened this issue Nov 24, 2020 · 1 comment · Fixed by #378
Closed
Labels
bug Something isn't working
Milestone

Comments

@xoviat
Copy link
Contributor

xoviat commented Nov 24, 2020

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.

@angelozerr
Copy link
Contributor

I am not currently set-up to debug vscode extensions, but I may tackle this if I have time.

It should be really nice! Thanks!

xoviat added a commit to xoviat/vscode-xml that referenced this issue Dec 6, 2020
Fixes redhat-developer#374.

registry logic was incorrect in old version, but fixed in new version.
@angelozerr angelozerr added the bug Something isn't working label Dec 10, 2020
@angelozerr angelozerr added this to the 0.15.0 milestone Dec 10, 2020
@datho7561 datho7561 removed their assignment Dec 10, 2020
datho7561 pushed a commit that referenced this issue Dec 10, 2020
Fixes #374.

registry logic was incorrect in old version, but fixed in new version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants