From 10e0aec3a6485acba0afcf8da03d63ad5b409e8f Mon Sep 17 00:00:00 2001 From: ibbem Date: Fri, 5 Sep 2025 18:27:41 +0200 Subject: [PATCH] Ignore missing JAR in native installations Do not check for the existence of a JAR if a native command is preferred and there is a suitable executable. I was hit by this issue on NixOS which puts the JAR at a different location than the auto detection of this package expects it. The alternative, setting `lsp-java-server-install-dir` such that the JAR instead of the executable is found, leads to a failure. When the JAR is launched directly, jdtls tries to write to the Nix Store which is read-only. Launching the jdtls executable provided by nixpkgs works perfectly though. --- lsp-java.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lsp-java.el b/lsp-java.el index d2ddde0..9f49ec2 100644 --- a/lsp-java.el +++ b/lsp-java.el @@ -1401,7 +1401,10 @@ current symbol." (lsp-register-client (make-lsp--client :new-connection (lsp-stdio-connection #'lsp-java--ls-command - #'lsp-java--locate-server-jar) + (lambda () + (or (and lsp-java-jdt-ls-prefer-native-command + (lsp-java--locate-server-command)) + (lsp-java--locate-server-jar)))) :major-modes '(java-mode java-ts-mode jdee-mode) :server-id 'jdtls :multi-root t