pepijnve commented on code in PR #883:
URL: https://github.com/apache/arrow-java/pull/883#discussion_r2425433938
##########
c/src/main/java/org/apache/arrow/c/jni/JniLoader.java:
##########
@@ -75,8 +75,24 @@ private synchronized void loadRemaining() {
}
private void load(String name) {
+ String libraryName = System.mapLibraryName(name);
+
+ // If 'arrow.cdata.library.path' is defined, try to load the native
library from there
+ String libraryPath = System.getProperty("arrow.cdata.library.path");
+ if (libraryPath != null) {
+ try {
+ File libraryFile = new File(libraryPath, libraryName);
+ if (libraryFile.isFile()) {
+ System.load(libraryFile.getAbsolutePath());
+ return;
+ }
+ } catch (UnsatisfiedLinkError e) {
+ // Ignore this error and fall back to extracting from the JAR file
Review Comment:
In my specific application the native library will be have been stripped
from the jar and loading will fail so the end result will be the same either
way.
I modeled this on examples like the ones I referenced where possible
alternatives are tried in a specified order. Happy to change this to fail early
though. Let me know what you would prefer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]