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

JPackage app-image exe launches multiple exe's in JDK 22+

XMLWordPrintable

    • b23
    • generic
    • windows

      ADDITIONAL SYSTEM INFORMATION :
      OpenJDK 22 on Windows 11

      A DESCRIPTION OF THE PROBLEM :
      Current revisions of jpackage generate exe launchers for Windows that by design always spawn 2 instances:
      https://bugs.openjdk.org/browse/JDK-8272328

      The reason for this is adding the "app" folder to the java.library.path by default, which can only be done via the %PATH% environment variable due to jli internals, but %PATH% cannot be changed for the current process due to Windows internals, so the process starts another instance with a slightly altered environment. This is clunky, but acceptable *if* auto-adding "app" folder to the java.library.path were indeed necessary. However, it's not necessary if there's no *.dll files in the "app" folder, it's not necessary if java.library.path is set via java-options already, etc.

      The "first instance starts second instance which then launches the application" behavior is especially odd for win-console exe launchers since the first console exe will wait for the second console exe to finish before they can both exit.

      I would like to request a way to disable this "restart" behavior since it doesn't do anything for me.

      I would recommend checking the java-options= list and for a java.library.path= entry and then not do the "restart" behavior if the developer has already manually set the library path correctly.

      REGRESSION : Last worked in version 16

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      jpackages should generate exe files that (if possible) only spawn 1 process
      ACTUAL -
      exe files generated by jpackage spawn 2 processes

      FREQUENCY : always


            asemenyuk Alexey Semenyuk
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: