如何在java android项目中使用.so和.jar?

发布于 2025-01-06 19:16:54 字数 416 浏览 4 评论 0原文

我正在开发一个 java android 项目。该项目需要使用特定命令。 这些命令都是用 c++/c 开发的,但我得到了两个文件(.jar 和 .so),应该将它们“转换为”java,所以我可以在我的 java android 项目中使用它们。

问题是,我该怎么处理这两个文件?我读了很多东西(主要是关于创建 .jar 和 .so,但我不关心这一步,因为我已经有了这两个文件)

我尝试导入 .jar (导入外部库),我尝试通过静态加载添加 .so : //静止的 { // System.loadLibrary("MySoFile"); // } 我得到的只是堆栈溢出错误或 DEX 文件问题...

有人尝试过这样做吗? 我似乎不明白这里的重点...我想做的就是能够使用 .jar 文件中的命令... ://

提前感谢!

I'm working on a java android project. this project requires to use specific commands.
these commands are all developed in c++/c but I've been given two files (.jar and .so) that are supposed to "turn them into" java, so I can use them in my java android project.

The thing is, what am I supposed to do with these 2 files?? I've read a lot of stuff (mostly about creating the .jar and .so, but I don't care about this step, for I already have the 2 files)

I tried to import the .jar (import external lib), I tried to add the .so via the static loading :
//static {
// System.loadLibrary("MySoFile");
// }
All I get is a stack overflow error or a problem with the DEX file...

Has anybody ever tried to do this??
I don't seem to get the point here...all I want to do is being able to use the commands in the .jar file.... ://

thanks in advance!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一影成城 2025-01-13 19:16:54

看看这个答案关于添加 jar 文件。 “.so”文件通常只需拖放到项目中即可。

Take a look at this answer about adding jar files. '.so' files can usually just be drag and dropped to the project.

·深蓝 2025-01-13 19:16:54

您需要做的就是确保该 jar 位于您的类路径中,然后您就可以访问该 jar 中的类。 jar 只是类的存档,您不需要将库加载到内存或类似的东西中。

您可能想在此处阅读问题的答案 如何使用 .jar 中的类文件?

All you need to do is make sure the jar is in your classpath and you can then access the classes within this jar. A jar is just an archive of classes, you don't need to load the library into memory or something similar.

You may want to read the answer to the question here How to use classes from .jar files?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文