準備工做:java
1.打開eclipse,新建c++項目,編寫c++ jni接口以下圖:c++
2.編譯運行生成dll文件,導入到java項目,在java中建立調用使用,以下圖:數組
C文件定義:eclipse
頭文件對象
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
#include<string.h>
/* Header for class AireplayWifiSrvLinariesLib */
#ifndef AireplayWifiSrvLinariesLib
#define AireplayWifiSrvLinariesLib
#ifdef __cplusplus
extern "C" {
#endif
調用方法定義blog
#ifdef __cplusplus
}
#endif
#endif接口
.cpp文件重寫定義方法ip
可針對map,對象,數組,字符串,數字,自定義數據類型調用使用,與返回對應數據。字符串