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

jpackage: ResourceEditor error when path is overly long on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • 17, 18, 19, 20
    • tools
    • b25
    • generic
    • windows

      When build root directory path is long and paths in supplementary build directories (like: "images/win-msi.image/app/app.exe") exceed Windows MAX_PATH limit, jpackage fails
      on the ExecutableRebrander::rebrandExecutable step:

      [2022/07/05 08:59:47.497, jpackage.dll (PID: 4064, TID: 4308), jpackage.cpp:51 (Java_jdk_jpackage_internal_ExecutableRebrander_lockResource)]
      ERROR: Exception with message 'ResourceEditor.cpp(37) at ResourceEditor::FileLock::FileLock(): BeginUpdateResource(C:\[very\long\path]\images\win-msi.image\hello\hello.exe) failed. System error [3](system error 3 (The system cannot find the path specified))' caught
      [08:59:34.276] Running candle.exe
      [08:59:34.308] Running C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe
      [08:59:34.401] Running light.exe
      [08:59:34.416] Running C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe
      [08:59:34.588] Detected [candle.exe] version [3.11.2.4516].
      [08:59:34.588] Detected [light.exe] version [3.11.2.4516].
      [08:59:34.588] WiX 3.11.2.4516 detected. Enabling advanced cleanup action.
      [08:59:47.466] Command [PID: -1]: jlink --output [...]
      [08:59:47.466] Returned: 0
      [08:59:47.466] Using custom package resource [icon] (loaded from file C:\path\to\icon.ico).
      [08:59:47.497] java.lang.RuntimeException: Failed to lock: C:\[very\long\path]\images\win-msi.image\hello\hello.exe
      at jdk.jpackage/jdk.jpackage.internal.ExecutableRebrander.rebrandExecutable(ExecutableRebrander.java:130)
      at jdk.jpackage/jdk.jpackage.internal.ExecutableRebrander.rebrandExecutable(ExecutableRebrander.java:96)
      at jdk.jpackage/jdk.jpackage.internal.ExecutableRebrander.rebrandLauncher(ExecutableRebrander.java:77)
      at jdk.jpackage/jdk.jpackage.internal.WindowsAppImageBuilder.createLauncherForEntryPoint(WindowsAppImageBuilder.java:140)
      at jdk.jpackage/jdk.jpackage.internal.WindowsAppImageBuilder.prepareApplicationFiles(WindowsAppImageBuilder.java:100)
      at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.createAppBundle(AppImageBundler.java:183)
      at jdk.jpackage/jdk.jpackage.internal.AppImageBundler.execute(AppImageBundler.java:91)
      at jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.prepareProto(WinMsiBundler.java:370)
      at jdk.jpackage/jdk.jpackage.internal.WinMsiBundler.execute(WinMsiBundler.java:427)
      at jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.java:700)
      at jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments.java:565)
      at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:91)
      at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)


      The same problem was observed when running:

      make run-test TEST=jdk/tools/jpackage/windows/WinInstallerUiTest.java

      where temp directory supplied to JTreg is already quite long and with the long application name resulting launcher .exe path exceeds MAX_PATH.
      Problem happens the same way if a long path is specified to jpackage with a --temp flag.

      It is proposed to investigate possible solutions to the problem and, at least, provide more specific warning message in this case.

            asemenyuk Alexey Semenyuk
            akasko Alex Kasko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: