Can C++ Application load the .jar File using JNI?

半腔热情 提交于 2019-11-30 15:34:48

Your question isn't completely clear, but I will give a general answer...

In Java there is only two ways to get Java to look in a .jar file (and they really boil down to one way in the end), and that's to specify the .jar file in the classpath, or to create a classloader that will look in that jar file and add it to the list of classloaders Java will use.

And, of course, all the classpath is is a set of classloaders that Java instantiates and uses before your program even starts.

So a JNI program needs to make the Java calls (which I'm not looking up just now) to set up a new class loader and get Java to start using it if the JNI program needs Java to start looking in additional .jar files.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!