imagej-launcher icon indicating copy to clipboard operation
imagej-launcher copied to clipboard

Zulu JDK failing to load native libs on windows

Open hinerm opened this issue 2 years ago • 3 comments

It looks like the launcher is not configuring the java.library.path in a way that's compatible with the Zulu JDK.

See this forum thread.

hinerm avatar Dec 21 '22 20:12 hinerm

I've been trying to chase this one down for a while now as well: https://forum.image.sc/t/imagej-tensorflow-now-with-command-to-change-tensorflow-library-version-switch-to-gpu/31744/24?u=markkitt

mkitti avatar Dec 21 '22 21:12 mkitti

My theory is that something is getting confused by the inconsistent use of slashes and backslashes. What's strange is that some are reporting that this could be dependent on the shell / command prompt. There is also possible environment variable involvement.

Regarding environment variable involvement we are using putenv: https://github.com/imagej/imagej-launcher/blob/47befcbde8ce3ce114b590764a86caa6c2b4e654/src/main/c/platform.c#L701

This is actually deprecated: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv?view=msvc-170

_putenv_s is preferred with regard to the C Runtime: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv?view=msvc-170 https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-s-wputenv-s?view=msvc-170

The problem with Windows is that there is often more than one C Runtime (CRT) lying around. What we really want to do is set it for the entire process tree. In that case we may want to use

SetEnvironmentVariable and GetEnvironmentVariable from the Win32 API: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setenvironmentvariable

The blocker for me in solving this is that I cannot reproduce the issue yet.

mkitti avatar Dec 21 '22 21:12 mkitti

Can someone figure out how to reproduce the issue?

mkitti avatar Dec 21 '22 21:12 mkitti