java 部分 class BMPinfomation{
public int mapHeight;
} public class Main {
public BMPinfomation BMPobject ;
public native void func();
static {
try{System.loadLibrary("CaptureDLL");}
catch (Exception e){}
}
public static void main(String[] args) {
Main test = new Main();
test.BMPobject = new BMPinfomation();
test.func();
}
} c部分
JNIEXPORT void JNICALL Java_cameracapturer_Main_func
(JNIEnv *env, jobject obj,)
jfieldID fid;
jobject BMPinfoObj;
jclass BMPinfoCls;
jclass cls = (env)->GetObjectClass(obj); fid = (env)->GetFieldID(cls, "BMPobject","LBMPinfomation;");//这里出错了 得到的fid为空
if(fid == NULL)
::AfxMessageBox("fid == NULL"); BMPinfoObj = (env)->GetObjectField(obj, fid);
(env)->GetFieldID()最后个参数前面加了包名 得到的fid仍然为空 郁闷死了 不好意思 发了2遍。。
public int mapHeight;
} public class Main {
public BMPinfomation BMPobject ;
public native void func();
static {
try{System.loadLibrary("CaptureDLL");}
catch (Exception e){}
}
public static void main(String[] args) {
Main test = new Main();
test.BMPobject = new BMPinfomation();
test.func();
}
} c部分
JNIEXPORT void JNICALL Java_cameracapturer_Main_func
(JNIEnv *env, jobject obj,)
jfieldID fid;
jobject BMPinfoObj;
jclass BMPinfoCls;
jclass cls = (env)->GetObjectClass(obj); fid = (env)->GetFieldID(cls, "BMPobject","LBMPinfomation;");//这里出错了 得到的fid为空
if(fid == NULL)
::AfxMessageBox("fid == NULL"); BMPinfoObj = (env)->GetObjectField(obj, fid);
(env)->GetFieldID()最后个参数前面加了包名 得到的fid仍然为空 郁闷死了 不好意思 发了2遍。。
http://www.javaeye.com/post/254139
自己看下,相信可以解决你的问题!