Command.java:
public class Command {
public static native String getStringFromC(String a);
static {
System.loadLibrary(“ndk-demo”);
}
}
#-d 指明产生文件的目录,
javac ./java/com/popoaichuiniu/jacy/examplelearning/Command.java -d .
#-classpath 指明查找的class文件的路径
#-d 指明产生头文件的目录
javah -classpath . -d ./jni com.popoaichuiniu.jacy.examplelearning.Command
产生如下头文件:
/* DO NOT EDIT THIS FILE – it is machine generated */
#include
/* Header for class com_popoaichuiniu_jacy_examplelearning_Command */
#ifndef _Included_com_popoaichuiniu_jacy_examplelearning_Command
#define _Included_com_popoaichuiniu_jacy_examplelearning_Command
#ifdef __cplusplus
extern “C” {//如果使用C++,包含这个头文件,就需要extern c。
#endif
/* * Class: com_popoaichuin