如何从 Gradle 的 jar 文件中加载共享库(.so 文件)?

huangapple 未分类评论42阅读模式
英文:

How can we load shared libraries (.so) from a jar file in gradle?

问题

如何从Gradle的jar文件中加载共享库?

如果我有一个包含共享库的文件夹,操作很简单:

System.loadLibrary("libname");

我可以像这样指定库目录:

systemProperty "java.library.path", file("${buildDir}/libs/native/").absolutePath

但如果这些文件被打包到一个jar文件中,应该如何操作?

英文:

How can I load shared libraries from a jar file in gradle?

If I have a folder with the shared library it is straightforward:

System.loadLibrary("libname");

and I would specify the lib directory like:

systemProperty "java.library.path", file("${buildDir}/libs/native/").absolutePath

But how can this be done if the files are packed into a jar?

huangapple
  • 本文由 发表于 2020年4月5日 02:34:37
  • 转载请务必保留本文链接:https://java.coder-hub.com/61032961.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定