ensure absolute native library path in Java Loader#3728
Conversation
|
happy to add a test case for the offending tmpdir setting as well though I thought it might be overkill |
|
Hey @Mizux thanks for reviewing! I don't think the checks issues are related to the PR content, is there anything you'd like me to do before merging? |
Yup, as usual our main (aka dev) branch is borken on windows... To be honest, I just wanted to play with this patch to understand all the implications (e.g. try to use it in a maven Java app to see what's happen, test it in https://github.com/mizux/java-native etc...). Sorry for the delay and thx for the PR. |
Ensures that the native library path is absolute before loading to avoid
java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library.In my particular case the issue arises when running as part of an application that has
java.io.tmpdirset to a relative path which results in the constructed tempDir path being relative. We could alternatively force the tempDir path to be absolute immediately on creation, but forcing the path to be absolute immediately before the call that cares seems more future proof. I'm currently using a custom loader to avoid this issue but I figured I'd contribute in case anyone else hits this edge case.