Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure absolute native library path in Java Loader #3728

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

afloren
Copy link
Contributor

@afloren afloren commented Mar 30, 2023

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.tmpdir set 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.

@afloren
Copy link
Contributor Author

afloren commented Mar 31, 2023

happy to add a test case for the offending tmpdir setting as well though I thought it might be overkill

@afloren
Copy link
Contributor Author

afloren commented Apr 4, 2023

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?

@Mizux
Copy link
Collaborator

Mizux commented Apr 5, 2023

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...).
I guess we have to follow plan B -> I'll merge it and revert it if lot of user complains about some path error/loading issue.

Sorry for the delay and thx for the PR.

@Mizux Mizux merged commit ea111e4 into google:main Apr 5, 2023
Mizux added a commit to Mizux/java-native that referenced this pull request Apr 5, 2023
@Mizux Mizux added this to the v9.12 milestone Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants