RFR: 8348828: Windows dll loading now resolves symlinks
Benjamin Peterson
duke at openjdk.org
Sat Oct 18 00:09:03 UTC 2025
On Wed, 8 Oct 2025 12:36:23 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> A better starting point for discussion would be a test that exercises System.loadLibrary with the a library name that locates a DLL through a sym link to a final target that doesn't have the .dll suffix.
To this end, I have updated the PR to add a test `test/jdk/java/lang/ClassLoader/loadLibrarySymlinks/LoadLibrarySymlinksTest.java`. This test exercises the 3 cases discussed in https://mail.openjdk.org/pipermail/core-libs-dev/2025-October/152992.html.
Unix platforms pass this test as expected. Since I reverted all of my proposed fixes, Windows fails handling the `test2.dll -> barename` case:
java.lang.UnsatisfiedLinkError: D:\\a\\jdk\\jdk\\build\\run-test-prebuilt\\test-support\\jtreg_test_jdk_tier1_part1\\scratch\\barename: Can't find dependent libraries
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:326)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:187)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:129)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2282)
at java.base/java.lang.Runtime.load0(Runtime.java:767)
at java.base/java.lang.System.load(System.java:1646)
at LoadLibrarySymlinksTest.main(LoadLibrarySymlinksTest.java:48)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:335)
at java.base/java.lang.Thread.run(Thread.java:1474)
JavaTest Message: Test threw exception: java.lang.UnsatisfiedLinkError
I hope this aids in understanding the issue and review my proposed fix(es).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24694#issuecomment-3417543831
More information about the hotspot-runtime-dev
mailing list