Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8314491

Linux: jexec launched via PATH fails to find java

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 17, 21, 22
    • tools
    • None
    • b15
    • linux

      jexec uses argv[0] parameter to find its own location[1]. argv[0] is populated with the command value causing a failure to locate java[2] when jexec is found in the PATH (in this case argv[0] contains just 'jexec').

      We can use /proc/self/exe to locate the executable path on Linux.
      The code already contains Linux-specific defines[3], and the use-case is specific to Linux. I am proposing to limit the fix only to the Linux platform.

      Note: I am happy to work on this issue.

      [1] https://github.com/openjdk/jdk/blob/0c3bc71d24fa13a0b1e55541c01554cd5e124027/src/java.base/unix/native/launcher/jexec.c#L169
      [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029342
      [3] https://github.com/openjdk/jdk/blob/0c3bc71d24fa13a0b1e55541c01554cd5e124027/src/java.base/unix/native/launcher/jexec.c#L184C1-L185C1

            vpetko Vladimir Petko
            vpetko Vladimir Petko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: