JDK-8274087 : Windows DLL path not set correctly.
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: 17,18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2021-09-21
  • Updated: 2021-09-30
  • Resolved: 2021-09-24
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 b17Fixed
Description
Windows native code in java in several places assumes the runtime bin directory is in the DLL path by loading dll's without full path.
One example of this is zip.dll, src/java.base/share/native/libjimage/imageDecompressor.cpp where LoadLibrary("zip.dll"); is called (no full path to dll used).  There are other instances of this.

In jpackage we work around this by calling SetDllDirectory(runtimeBinPath.c_str());
in WinLauncher.cpp, but the runtimeBinPath used is based on the default runtime location, instead of the actual runtime location.

As a result, if runtime is moved, custom splash screen will fail to load.
Also using https connection may result in:
 Exception in thread "Reader-BG-1" java.lang.InternalError: platform 
encoding not initialized


Comments
Changeset: f36a2bbd Author: Andy Herrick <herrick@openjdk.org> Date: 2021-09-24 12:43:25 +0000 URL: https://git.openjdk.java.net/jdk/commit/f36a2bbd15d94d4371c2117ce08b7f04a0d59da4
24-09-2021

Uploaded example project FetchURL.zip that results in "java.lang.InternalError: platform encoding not initialized" when the runtime folder isn't the default. (may need to tweak the toolchain in the build.gradle file to remove the vendor spec)
21-09-2021

This seems a good candidate to consider for a backport to jdk17u for 17.0.2.
21-09-2021