Downloading Metals (Vscode Scala extension) failed with the following: spawn C:\Program Files (x86)\Java\jdk1.8.0_144\bin\bin\java ENOENT
Asked Answered
C

2

6

I'm trying to run a Scala program on the vscode. I tried downloading Scala (Metals) Extension but it gives me the following error.

Failed to download Metals, make sure you have an internet connection and the Java Home 'C:\Program Files (x86)\Java\jdk1.8.0_144\bin' is valid. You can configure the Java Home in the settings. See https://scalameta.org/metals/docs/editors/vscode.html#http-proxy for instructions if you are using an HTTP proxy.

I'm not using any proxy. I checked my environment variables and the JAVA_HOME system variable is set to "C:\Program Files (x86)\Java\jdk1.8.0_144\bin"

I have Java 8 installed on my machine but not on VSCODE. Can that be a problem?

Copenhagen answered 6/1, 2022 at 15:53 Comment(2)
It sounds like the metals installer can't get a JVM to run utils. You might try: 1) verify that the path 'C:\Program Files (x86)\Java\jdk1.8.0_144\bin' is valid. 2) make sure your vscode can find java. see code.visualstudio.com/docs/languages/java Metals is probably trying to download bits from the net and that is failing for some reason. The proxy thing is usually only an issue if you are doing this in the office and they proxy the internet.Hootchykootchy
Does this answer your question? Why should JAVA_HOME environment variable value point to SDK directory instead of bin?Loveless
G
4

Your JAVA_HOME should not have the bin part at the end. i.e. it should be C:\Program Files (x86)\Java\jdk1.8.0_144\

Geyer answered 18/10, 2022 at 9:34 Comment(0)
S
1

@hughj is correct. I had the same problem and reviewing/updating my java install and configuration allowed the Metals extension to download.

Strychnic answered 3/6, 2022 at 15:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.