lsp-java JDT keeps crashing, suspect too many projects in workspace src

Steinar Bang <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
I have been using lsp-java and JDT to spice up my Java editing in emacs,
since late June 2025
 https://lists.gnu.org/archive/html/help-gnu-emacs/2025-06/msg00274.html

However, I have a lot of different Java maven projects and I have added
all of them as I go and at some point it probably has gotten too big for
the JDT process, because now JDT crashes just after starting up.

There is nothing in the *jdtls::stderr* buffer, other than the text:

Process jdtls stderr finished


In ~/.emacs.d/ there are the following interesting subdirectories:
 .cache/lsp/eclipse.jdt.ls
 eclipse.jdt.ls
 workspace

I think the culprit for the crashing is probably here:
 .emacs.d/workspace/jdt.ls-java-project/src/no/priv/bang

Under here I find the source of all of the imported projects (or at
least: all the ones I was able to import befor JDT started crashing on
startup).  So at some point there probably became too much java source
for it to chew, maybe...?

Is it possible to spread the load somehow?

It is OK for me to stop and start JDT with a smaller selection of
projects (ideally just one), because I can just work on a single project
at a time.

But would be nice to not have to stop and start the JDT processes manually.

It would also be nice to visit a file in a different project without
killing the JDT I am currently in (maybe JDTs could be started lazily
and stopped when not being used for a while?).

Is this possible somehow?

Or is the crash something else entirely and not related to "too many
projects, too much source", at all...?

This is my current .emacs config for java treesitter and lsp-java:

(when (treesit-language-available-p 'java)
  (add-to-list 'major-mode-remap-alist '(java-mode . java-ts-mode))
  (when (require 'lsp-java nil t)
    (setopt lsp-java-format-enabled nil)
    (add-hook 'java-ts-mode-hook #'lsp))
  (when (require 'lsp-java-boot nil t)
    (add-hook 'lsp-mode-hook #'lsp-lens-mode)
    (add-hook 'java-ts-mode-hook #'lsp-java-boot-lens-mode)))

Thanks!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.