I have an app which makes use of 3 different JAR libraries…lets call them a.jar, b.jar and c.jar.
Each of these JARS have an accompanied native C++ shared object.
Now, both a.jar and b.jar import and use c.jar.
So, my question is – what is the best approach when loading the native libs using system.loadLibrary ?
Can I just load them all from my app code or do they have to be loaded by the respective JAR ?
If I load them from the respective JAR file, will load in a separate thread?
It is Classes’ responsibility to load native libraries.
Let’s assume every jar file also has classes called A, B and C. All those classes needs to load their native companions most probably via a static way.
In such structure it will be the class loader who loads and initialize class C when you access class A.