Subject: [PATCH 1/1] gnu: antlr4: Pass full path to java in bin executable

From: Rutherther <[email-masked]>
Date: Sun, 17 Nov 2024 20:43:58 +0100

The executable outputted by antlr4 package does not
refer to full path of java, but to standalone "java".
That means the package expects java to be in PATH.
Since it's an application, requiring java to run,
it should rather refer to full path of java executable
it was built with/for.

* gnu/packages/java.scm: (antrl4)[arguments]: Change "java" in bin/antlr4 for full path

Change-Id: I311b9ec54a90fc7251eb8fcb62b232e843853e64
---
 gnu/packages/java.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index df57385ea7..8607b62bea 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -8866,13 +8866,14 @@ (define-public antlr4
          (add-after 'install 'bin-install
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((jar (string-append (assoc-ref outputs "out") "/share/java"))
-                   (bin (string-append (assoc-ref outputs "out") "/bin")))
+                   (bin (string-append (assoc-ref outputs "out") "/bin"))
+                   (java (search-input-file inputs "bin/java")))
                (mkdir-p bin)
                (with-output-to-file (string-append bin "/antlr4")
                  (lambda _
                    (display
                      (string-append "#!" (which "sh") "\n"
-                                    "java -cp " jar "/antlr4.jar:"
+                                    java " -cp " jar "/antlr4.jar:"
                                     (string-join
                                       (apply
                                         append
-- 
2.46.0