JDK-8272328 : java.library.path is not set properly by Windows jpackage app launcher
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: 17,18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: generic
  • Submitted: 2021-08-11
  • Updated: 2024-09-17
  • Resolved: 2021-08-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 18
17.0.2Fixed 18 b11Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
JDK-8267598 removed the regression caused by JDK-8263157 without actually fixing the problem described in JDK-8263157 on Windows.
JDK-8267598 fix was to set environment variable used by JLI initialization code to configure the value of java.library.path system property instead of setting the system property directly.
It turned out that on Windows setting `PATH` environment variable from jpackage app launcher doesn't affect the output of getenv() called from jli.dll from open/src/hotspot/os/windows/os_windows.cpp os::init_system_properties_values().

Comments
Changeset: cd2dbe5f Author: Alexey Semenyuk <asemenyuk@openjdk.org> Date: 2021-08-11 20:54:58 +0000 URL: https://git.openjdk.java.net/jdk/commit/cd2dbe5f007baf81ae9262c1152917e620970621
11-08-2021

Suggested solutions: 1.) Modify jli code to set default java.library.path based on current environment, not based on the environment when executable was loaded. I.e. use GetEnvironmentVariable() instead of getenv() to get the value of `PATH` in os::init_system_properties_values(). 2.) Restart jpackage app launcher with an altered PATH environment variable. 3.) Don't fix the issue as on Windows java.library.path system property contains the path to directory with app launcher, so if the app requires custom native libs, they can be placed in this directory. Neither option is great. Opted to implement #2.
11-08-2021