I am trying to download the linux.so file at runtime in Java, but I get UnsatisfiedLinkError. I pass the argument -Djava.library.path = / Users / tom / codebase / jni / dist VM when starting below the main java from my Test.class. The libSample.so file is located in the / Users / tom / codebase / jni / dist directory. Any ideas? Thanks!
public class Test { public static void main(String[] args) { System.out.println(System.getProperty("java.library.path"));
VM argument:
-Djava.library.path=/Users/tom/codebase/jni/dist
An exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no Sample in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1045) at Test.main(Test.java:9)
I also tried using a direct approach attempt (using System.load) and got the results below if they help any Exception in the main thread java.lang.UnsatisfiedLinkError: /Users/tom/codebase/jni/dist/libSample.so: No matching image found. Found: /Users/tom/codebase/jni/dist/libCiscoEnergyWiseJni.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00
source share