5

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?

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • 1
    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 https://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. – hughj Jan 06 '22 at 21:32
  • Does this answer your question? [Why should JAVA\_HOME environment variable value point to SDK directory instead of bin?](https://stackoverflow.com/questions/30241171/why-should-java-home-environment-variable-value-point-to-sdk-directory-instead-o) – Stephen C Oct 18 '22 at 09:50

2 Answers2

2

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\

1

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

Beege
  • 665
  • 4
  • 18