From 3eafb650863ef4f22e45ac964a0e8f8be0727ce1 Mon Sep 17 00:00:00 2001 From: Neeme Praks Date: Tue, 21 Jun 2022 16:19:07 +0300 Subject: [PATCH] #224 Allow to specify native library name via a system property (and skip auto-detection) --- src/main/java/gnu/io/NativeResource.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/gnu/io/NativeResource.java b/src/main/java/gnu/io/NativeResource.java index a9ef7c4..147849a 100644 --- a/src/main/java/gnu/io/NativeResource.java +++ b/src/main/java/gnu/io/NativeResource.java @@ -104,6 +104,11 @@ private void inJarLoad(String name)throws UnsatisfiedLinkError, NativeResourceEx private void loadLib(String name) throws NativeResourceException { try { + String libNameFromClasspath = System.getProperty(name + ".classpathlib"); + if(libNameFromClasspath != null) { + inJarLoad(libNameFromClasspath); + return; + } if(OSUtil.isARM()) { //System.err.println("Attempting arm variants"); for(String libName : OSUtil.is64Bit() ? ARM64_LIBS : ARM32_LIBS) {