Hello,
I'm writing a native executable to create a VM with JNI_CreateJavaVM using a private Java runtime (bundled with the application).
The program works well on Windows 11 but I have a weird issue on Windows 7. I know this OS is old/unsupported/etc. but some of my clients are still using it so I need to make it work.
The first issue I have is that, apparently, the jvm.dll can't find its dependencies as it does on Windows 11, it needs the path set to the java runtime bin directory. Fine, if I set the PATH variable manually before launching the program from a command windows, it works well.
The weird issue is that if I set the PATH from within the native executable or use the SetDllDirectory function, then I get an error that it can't find ucrtbase.terminate from api-ms-win-crt-runtime-l1-1-0.dll (the DLL is there as it is part of the JRE).
Has anyone had this kind of problem and solved it ?
I repeat, manually set the PATH before launching the executable works fine, so the loader works, but setting the PATH from within the application doesn't seems to have the same effect. Can't tell the user to set the PATH, this would not be acceptable.
Some additional info, I'm using the JRE 17 64bit (Windows 7 64 bit as well) haven't tried with a more recent JRE. I'm using mingw64 gcc as compiler.
Thanks for any hint on how to solve the problem.