Hi all, I tried following JNI program. It was displayed "JNI panic ... " message on the screen when if executed it. I don't understand something wrong. Please advice me < My Test Environment(when wrong message): > < arm-linux 2.2.14(CPU=SA1110) + jdk118_v2 > Addition: But, it works if excuted on <x86-linux 2.2.14 + jdk118>. /******************************************************/ // JNI test program "HelloWorld.java" public class HelloWorld { static { System.loadLibrary("helloworld"); } public static native void Hello(String strArray); public static void main(String[] args) { System.out.println ("call JNI method"); Hello("---> Hello JNI method"); } }// class HelloWorld /******************************************************/ #include "HelloWorld.h" JNIEXPORT void JNICALL Java_HelloWorld_Hello(JNIEnv *env, jclass clazz, jstring strP) { const char *str = (*env)->GetStringUTFChars(env, strP, 0); printf("%s\n", str); (*env)->ReleaseStringUTFChars(env, strP, str); } // how to compile: // gcc -shared -o libhelloworld.so -I/usr/local/jdk118_v2/include \ // -I/usr/local/jdk118_v2/include/linux hello.c -fPIC Executed message: ---------------------------------------------- $java HelloWorld call JNI method JNI panic: JNI string operation received a non string at HelloWorld.main(HelloWorld.java:17) ---------------------------------------------- Best Regards, Yuji Suzuki <FUNAI R&D., LTD.> ---------------------------------------------------------------------- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to