简体   繁体   English

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

[英]how to use a .so and .jar in a java android projet?

I'm working on a java android project. 我正在研究一个java android项目。 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. 这些命令都是用c ++ / c开发的,但是我已经给了两个文件(.jar和.so),它们应该“把它们变成”java,所以我可以在我的java android项目中使用它们。

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) 我已经阅读了很多东西(主要是关于创建.jar和.so,但我不关心这一步,因为我已经有了2个文件)

I tried to import the .jar (import external lib), I tried to add the .so via the static loading : //static { // System.loadLibrary("MySoFile"); 我试图导入.jar(导入外部lib),我试图通过静态加载.so来添加.so {// System.loadLibrary(“MySoFile”); // } All I get is a stack overflow error or a problem with the DEX file... //}我得到的是堆栈溢出错误或DEX文件的问题...

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.... :// 我似乎没有明白这一点......我想做的就是能够使用.jar文件中的命令....://

thanks in advance!! 提前致谢!!

Take a look at this answer about adding jar files. 看一下关于添加jar文件的答案 '.so' files can usually just be drag and dropped to the project. '.so'文件通常只需拖放到项目中即可。

All you need to do is make sure the jar is in your classpath and you can then access the classes within this jar. 您需要做的就是确保jar在您的类路径中,然后您可以访问此jar中的类。 A jar is just an archive of classes, you don't need to load the library into memory or something similar. jar只是类的存档,您不需要将库加载到内存或类似的东西。

You may want to read the answer to the question here How to use classes from .jar files? 您可能想要阅读此处问题的答案如何使用.jar文件中的类?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM