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

Invalid Metals server version opens "Unable to find a Java 11 or Java 17 installation ..." even if Java is installed #1134

Open
tanishiking opened this issue Aug 29, 2022 · 3 comments

Comments

@tanishiking
Copy link
Member

Describe the bug

To Reproduce Steps to reproduce the behavior:

Set Metals's server version to something like 0.11.8\ in VSCode setting.

{
    "metals.serverVersion": "0.11.8\\"
}

"Unable to find a Java 11 or Java 17 installation ..." will popup, even though the cause of error is not Java installation, but invalid Metals version (TypeError: Invalid Version: 0.11.8+38-1832a3cf-SNAPSHOT\).

Screen Shot 2022-08-29 at 15 53 50

Output

Java home: /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
Metals version: 0.11.8+38-1832a3cf-SNAPSHOT\
TypeError: Invalid Version: 0.11.8+38-1832a3cf-SNAPSHOT\
Unable to find a Java 11 or Java 17 installation on this computer. To fix this problem, update the 'metals.javaHome' setting to point to a Java 11 or Java 17 home directory or select a version to install automatically
Release notes was not shown: can't transform 0.11.8+38-1832a3cf-SNAPSHOT\ to 'major.minor.patch'

Expected behavior

Metals should show something like "Invalid Metals server version..." or "failed to download Metals..." instead of "Unable to find a Java ...".

Installation:

  • Operating system: macOS
  • VSCode version: 1.70.2
  • VSCode extension version: v1.19.0
  • Metals version: (found in VSCode settings, under metals.serverVersion): 0.11.8\

Additional context

Search terms

version java

@huntekah
Copy link

still facing the same issue:

Operating system: macOS
VSCode version: 1.66.0
VSCode extension version: v1.20.0
Metals version: (found in VSCode settings, under metals.serverVersion): 0.11.9

@tanishiking
Copy link
Member Author

Hey @huntekah !
As you set a valid metals.serverVersion, it looks like your case is a different issue :)
There may some reasons metals-vscode can't find your Java, but

  • Do you have Java downloaded?
  • If yes, where's the java home? (metals-vscode should be able to locate java home using locate-java-home library, but it may fail for some reason)
  • did you try setting metals.javaHome?
    • If yes, what did you set to the setting?

@bishabosha
Copy link

bishabosha commented Mar 17, 2023

I find that on my macOS installation, locate-java-home library only searches /Library/Java/JavaVirtualMachines and doesn't find the JAVA_HOME environment variable that was set by my .zprofile (and by cs java --jvm --setup)

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

3 participants