This is how I load the library.
static {
try {
System.load("/usr/lib/libname.a");
} catch (Exception e) {
e.printStackTrace();
}
}
}
When I choose .so (shared-library) application loads library without any error.
But there is a problem with loading static library.
While running the application exception happens :
Caused by: java.lang.UnsatisfiedLinkError: /usr/lib/libname.a: /usr/lib/libname.a: invalid ELF header (Possible cause: endianness mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[na:1.8.0_242]
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1946) ~[na:1.8.0_242]
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1828) ~[na:1.8.0_242]
at java.lang.Runtime.load0(Runtime.java:810) ~[na:1.8.0_242]
at java.lang.System.load(System.java:1088) ~[na:1.8.0_242]
Codes runs on Linux machine.