java-language-server
java-language-server copied to clipboard
package does not exist; vim-lsp
Hello.
I tried to setup this for my environment.
apt-get install openjdk-13-jre openjdk-13-jdk maven
git clone https://github.com/georgewfraser/java-language-server ~/src/java
cd ~/src/java/java-language-server
./scripts/link_linux.sh
mvn package -Dskiptests
ln -s dist/lang_server_linux.sh /usr/local/bin/java-language-server
# EDITED "DIR=" variable in this file to DIR=~/src/java/java-language-server/dist
export PATH JAVA_HOME=/usr/lib/jvm/openjdk-13
git clone https://github.com/HouariZegai/Calculator ~/src/java
vim ~/src/java/Calculator/src/main/java/com/houarizegai/calculator/Calculator.java # LSP server loads and shows ERR signs.
It works. Using the generic setup from https://github.com/mattn/vim-lsp-settings/blob/b37de024025cc34ee5f422fcf3638da99851e243/settings.json#L411
However java.awt
and java.swing
does not resolve. package does not exist
I am not a java programmer, but can you tell me if it is a problem with the server or something else?
I'm pretty sure this is an issue with the way this language server is packaged. From your description, you ran the scripts/link_linux.sh script as expected. That produces a slimmed down version of the JDK that does not include the java.desktop
module (which is the module that provides the java.awt
and java.swing
packages). Something about your editor setup seems to be causing the language server to require those packages but it's unclear why. For anything to be able to figure that out, you would need to provide the stacktrace produced by the language server, which vim-lsp would likely report in it's log file. If you'd like to verify that this is indeed the cause, just add java.desktop
to the list of modules linked by scripts/link_linux.sh and re-run the steps you posted above.
By some strange coincidence I have the exact same setup as @dezza, with all the same versions and I'm even using the same "Calculator" project to test it o.O
Anyway, I added java.desktop
to the list of linked modules as suggested in the comment above and that seems to work (the lsp is running and the errors are gone).