No, there is no way to load library from inside of a jar file without extracting it first, you need to extract the library at least into tmp
folder in order to be able to load it using eg:
System.load("path/to/libAbc.so")
It is not currently possible in java to load the library from memory or zip file. The method that loads the library is native void ClassLoader.NativeLibrary.load(String name)
, also the name
of the library is used internally by the java.lang.ClassLoader
to keep the track of loaded libraries, so currently you can't use anything different than a real file to be loaded as native library because it wouldn't fit the current mechanism.
Since the loading of the native library is done with the help of native code, the answer depends if there is a way to load the native library in a C code: dlopen from memory?
Theoretically it can be done, but bacause it is platform specific and have many aspects that needs to be considered and resolved it isn't implemented in Java and it isn't a standard and/or easy thing in C either.
Currently in java, there is no way to do it, this could change if someone will create such a native library that will do that, but for now I don't know any such library.