Emacs, eglot and Java
by manu
A few days ago, I’ve tried to setup an Emacs environment for Java. I’ve got it working with eglot
, the builtin LSP client and jdtls
, the only proper language server there is for Java. While it works out of the box, there are a few issues:
- It looks like
jdtls
needs some special treatments as it comes with its own features and capabilities. For this reason, someone came up witheglot-java
, a java extension for the eglot lsp client. It comes with a few utilities to create and run projects and tests but also the most important one for me: go-to-definition for builtin libraries and 3rd party packages. - The connection to the language server isn’t stable at all and interrupts again and again. I tried to run
eglot-reconnect
without success. In this case, I always had to delete the cache in my emacs user directory. A very slow and painful experience. It looks like other people on the offical #emacs IRC channel have observed something similar so I’m not the only one. This has most probably to do with the quirksjdtls
comes with and isn’t emacs fault.