I want to invoke the API provided by a ".so" file in a JAVA project. Can JAVA call the .so file on linux platform? Anyone开发者_运维技巧 could provide a solution? Thank you very much!
Can JAVA call the .so file on linux platform?
There are two ways to do this:
- JNI allows you to declare methods as - nativein Java, and implement then in some other language (typically C or C++) and provide them as ".so" files. However, you can't do this for any old ".so" file, because Java expects the methods in the ".so" to have JNI specific signatures.
- JNA allows you to call methods in arbitrary native libraries. You write Java code that provides a "native library declaration" to match the native methods' signatures, and the JNA infrastructure deals with the data type mapping, etc. 
Yes, via JNI.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论