-
Notifications
You must be signed in to change notification settings - Fork 129
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
Getting "invalid target release: 18" when installing java lsp via Mason in Neovim #273
Comments
Looks like you need to set JAVA_HOME to be at least Java 18 (not 11 or 1.8 (which is version 8, not 18)). |
How does this make sense? I'm running into the same issue setting up my environment. I'm not configuring Java 18 because its not LTS, and everything we are writing is written using Java 17. Is there a way to install a previous version of the language server that uses 17 instead? Surely everyone who wants to write Java and use the java-language-server can't be expected to use whatever version the language server specifies... Edit: ...and Java 18 isn't even an option in the standard Arch repos. |
I was just trying to be of assistance. Java 21 is LTS and is released now. |
Hi, is there any updates on this? I cannot update my java version since all our code is incompatible with Java 18. Is there anyway to make it work with Java 11? |
This was exactly the issue I came across and updating to v21 worked, thank you! |
Using v21 got me working as well |
I understand what he means. He doesn’t want the JAVA_HOME to be set to the newer version, but rather to the version he uses in his projects, to avoid any kind of incompatibility. So, I think the point is how to set different Java versions, one for this project and another for the Java Language Server, so it won’t lead to an error. Since it's a setup problem and not a issue with the lsp, I think this issue can be closed. |
Java 18 is an odd choice. I just manually changed it to 17 in pom.xml and it compiled just fine. |
How did you change this? Would you mind giving me the step by step to change it myself? Specifically, where should I download the repo to so that Mason can find it? |
@jonathanabennett , I ended up not using this lsp, I don't remember for what reason. I think I modified the pom file outside of mason, just to check if it'll manually compile. The changes necessary in pom.xml which should be at the top level are:
Note I'm taking this from a different pom just for illustration, if there are other tags inside properties don't touch them. Just change the java.version contents. This most probably is how I compiled it. But I don't think I ever installed it through mason. I guess you can specify a plugin path in lazy.nvim or plug or packer or you could even manually install it, but you need to check the documentation for how to do that. Instead I'd recommend settling for another lsp. |
I am trying to setup my neovim instance with Java LSP. I am using Mason to help install the LSPs. When installing java lsp I am getting following error:
I have tried setting
JAVA_HOME
to both11
and1.8
, but I get the same error.Here is the full log of the error
Please let me know how to fix the error or if you need any more information.
The text was updated successfully, but these errors were encountered: