The class name needs to be fully qualified (but *without* that leading /) It might be easier to use #pragma convert(819) to get a UTF-8 string.
#pragma convert(819) zclass_class = (*env)->FindClass(env, "com/mycomp/mysetset/enterprise/zclass"); #pragma convert(0) -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Janet Graff Sent: 31 March 2016 22:36 To: [email protected] Subject: JVM FindClass returning Null I have a JNI class whose import statement is import com.mycomp.mysubset.enterprise.zclass; I have a C program compiled in EBCDIC that created a JVM and is now attempting to do the FindClass. My class is stored in /u/vendor/jig/DOMYAPI3/com/mycomp/mysetset/enterprise/zclass.class My _CEE_ENVFILE has a CLASSPATH=/u/vendor/jig/DOMYAPI3:/u/vendor/jig/DOMYAPI3/com/mycomp/mysetset/enterprise:/u/Java6_31/J6.0/bin/j9vm Since I have to pass in UTF-8 strings I have tried __etoa() and iconv() on my native EBCDIC C strings before passing them into FindClass. FindClass is returning a Null. char myclass[]="zclass"; __etoa(myclass) zclass_class = (*env)->FindClass(env, myclass); if (zclass_class == NULL) { (*env)->ExceptionDescribe(env); printf("findClass returned NULL\n"); rc = ERR_NO_CLASS; } I have also tried __etoa("/com/mycomp/mysetset/enterprise/zclass"); and FindClass gets a null. I have also tried cd = iconv_open("UTF-8", "IBM-1047"); if (cd == (iconv_t)-1) { printf("iconv_open failed %d,%s\n", errno,strerror(errno)); return ERR_BAD_ICONV; } inleft = 0; outleft = sizeof(myclass); numBytes = iconv(cd, (char **)&myclass, &inleft, (char **)&myUTFclass, &outleft); if (numBytes == -1) { printf("iconv on myclass failed %d-%s\n", errno, strerror(errno)); return ERR_BAD_ICONV; } and passed the result into FindClass which still gets a NULL. Is this a CLASSPATH issue? Is this a character encoding issue? Also I expected to get back the java stack with this code (*env)->ExceptionDescribe(env); But SYSOUT only contains "Exception in thread "main". Should I expect more error stack data? Janet ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN -- This e-mail message has been scanned and cleared by Google Message Security and the UNICOM Global security systems. This message is for the named person's use only. If you receive this message in error, please delete it and notify the sender. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
