From 72649c7f2e55cd9f272fc939b6bb2c00ae23e456 Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:39:47 +0200 Subject: [PATCH] [lsp-magik] Support JAVA_HOME with trailing slash (#4139) --- clients/lsp-magik.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clients/lsp-magik.el b/clients/lsp-magik.el index b98cdf8bf8..05fc1f5a2f 100644 --- a/clients/lsp-magik.el +++ b/clients/lsp-magik.el @@ -88,8 +88,11 @@ :group `lsp-magik :package-version '(lsp-mode . "8.0.1")) -(defcustom lsp-magik-java-path (cond ((eq system-type 'windows-nt) "$JAVA_HOME/bin/java") - (t "java")) +(defcustom lsp-magik-java-path (lambda () + (cond ((eq system-type 'windows-nt) + (or (lsp-resolve-value (executable-find (expand-file-name "bin/java" (getenv "JAVA_HOME")))) + (lsp-resolve-value (executable-find "java")))) + (t "java"))) "Path of the java executable." :type 'string :group `lsp-magik @@ -108,7 +111,7 @@ :new-connection (lsp-stdio-connection (lambda () (list - (substitute-in-file-name lsp-magik-java-path) + (substitute-in-file-name (lsp-resolve-value lsp-magik-java-path)) "-jar" (substitute-in-file-name lsp-magik-ls-path) "--debug")))