-
Notifications
You must be signed in to change notification settings - Fork 334
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
Metals does not work with Java 9 #1037
Comments
I get the same problem on Java 8:
The error I'm getting is:
This is causing me problems in Emacs lsp-mode. |
Hm. Also getting it with Java 11. |
@Kazark thank you for reporting! What scala version are you using? This error happens when using 2.11 on jdk 11. |
These stack traces “java.base/java.lang.ClassLoader” only appear in jdk 11 |
The repo were I am having the problem is on 2.11. I think there was some hangup making it hard to upgrade, but I'm going to push a bit for upgrading. However, AFAIK I did not even have JDK 11 when I was first having this problem. I had JDK 13 and JDK 8, with my |
I'm on Scala 2.11 and Java 8, hitting the same issue as @Kazark
|
Hey @billiams that error only happens with JDK 11 and scala 2.11. Are you sure there is no other version installed? What happens if you specify java home by hand in the settings? If it doesn't help, please create a new issue with all the details. |
To clarify this problem, when you see in logs:
This means that there exists JDK 9+ and your project uses scala 2.11
Problem with multiple JDKs was also present in bloop(scalacenter/bloop#743) it looks like even if you set JAVA_HOME properly because of how Java is managed by OSX you might actually end up using different version. To not get confused and search for ghosts it would be ideal to test with ONLY JDK8 installed and then it should work but in case still something is wrong issue should be raised. Now tricky thing why there is a problem with 2.11 and not 2.12 or 2.13 in the first place? EDIT: |
This issue indeed seems to only affect Scala 2.11.x on JDK 9+. Scala 2.11 only supports JDK 8. The formatting of the following stack traces indicate you are running on JDK 9+ where there
I think there will eventually be a 2.11.13 release which improves JDK 9+ support, see scala/scala#8079 |
Yes it must be from JDK9+, I don't have other than JDK 11 installed(although now I know I should never be 100% sure as it looks like bloop can actually install jdk8 itself if not found so you never know :P ) Metals must be loading separate scala library depending on scala used in a project because metals is started with Might be obvious to you but I have still not found how and where this is all taking place inside metals :) It would be super awesome if this PR(scala/scala#8079) completely fixed scala 2.11 <-> JDK9+ issue and we could simply recommend users to update to 2.11.13 without changing anything(maybe a deprecation message) or maybe even better, if we know user uses scala |
@kpbochenek IT's all happening in
Bloop will not download any JDK, but will use anything on the PATH. |
@tgodzik Thanks! I will look up you are also right bloop won't download any JDK, I misinterpreted completely wrong PR about launcher changes :( |
Hey @tgodzik - thanks for the reply. I am setting java_home manually now in my .spacemacs: (setq lsp-metals-java-home "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home") and the problem seems to have gone away. |
Closing as fixed. |
Describe the bug
Using Java 9 with Metals results in crashes like
`Expected behavior
Metals should report a helpful message saying that Java 9 is not supported. The user can fix the problem by using either Java 8 or Java 11.
Installation:
Additional context
Reported on Discord https://discordapp.com/channels/632642981228314653/632841682211045396/639918405176131594
Search terms
The text was updated successfully, but these errors were encountered: