-
Notifications
You must be signed in to change notification settings - Fork 90
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
Does lsp-java support java 11? #114
Comments
It is meant to support even java12 - eclipse-jdtls/eclipse.jdt.ls#970 but for some reason, OpenJDK 11 does not work. I am running oracle jdk 8, do you have an option to switch? |
@yyoncho I don't, unfortunately. This is for work, so it would be hard to justify staying on Java 8 until the one guy running a weird Emacs setup can get everything in order :( Do you know how I could check if the install process picked up the right version of the language server? |
I just want to know in order to determine the priority of the issue. Is Oracle JDK 11 an option?
Why do you think that it might be picking wrong server? |
Yes, sure, I can run it locally; the artifacts for production will be built on the CI server anyway. Are you saying the language server works with Oracle JDK 11 but not OpenJDK 11 ?
Currently I don't think so, but this was one of the things I wanted to check initially and I wasn't sure how. |
It think that it might work. If it doesn't work I will try to find the issue with OpenJDK, it is either in startup params or in JDT LS. |
I tried just replacing OpenJDK 11 with Oracle's JDK and it didn't work any better, so I restored OpenJDK 11. What did work was removing the workspace directory entirely and restarting the LSP server. When I installed lsp-java I had only Java 8 set up, so I had a hunch that like in Eclipse, you need to add the JDKs that you want to use, but since I had no idea what file to edit I removed the whole thing. Now the Java 11 project works and these files in particular have changed:
|
So we are ok? |
Yes, everything works. I do wish this was documented here or on the eclipse.jdt.ls repo though. Sorry about the noise! |
@fgabolde can you do that? I am not quite sure that I understood what was the issue (you tried to reuse eclipse workspace initially?) |
No, I kept the Eclipse and eclipse.jdt.ls workspaces separate from the start. What happened I think is that when I had lsp-java install eclipse.jdt.ls, I had only Java 8 set up on my machine, so the LSP got set up for Java 8 only. Later I installed Java 11, but the LSP settings didn't change to match, even when I reinstalled the server. Eclipse was much the same, but in Eclipse you can open a dialog with a list of configured JDKs and add one. Doing the same with eclipse.jdt.ls is harder since you have to find out which files to edit. Once the LSP's workspace was cleared and LSP reinstalled, the LSP settings included the location of my Java 11 install. I still don't know how to add a new Java installation without clearing the whole LSP workspace, but at least it works for me now. |
FYI, something similar happened to me. I have a project that's set up to use Java 11 and I didn't set up my java location before downloading JDT LS so it automatically found Java 8. I also had to nuke the workspace folder to get things to work. |
I'm having a good time with lsp-mode and lsp-java on most projects at work, which are targeting Java 8. However, for the couple of projects that are targeting Java 11, I immediately run into trouble, with the following message:
and a lot of compile errors highlighted in the UI, especially on built-in types like Integer and String, like you'd get if running the wrong JDK. There is probably a misconfiguration on my part, but I can't find it.
The LSP session start looks like this:
When running M-! java-version, I get:
JAVA_HOME is correctly set as well.
I updated the edt backend very recently, using lsp-java's built-in installer.
What am I doing wrong?
The text was updated successfully, but these errors were encountered: