Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JNI - GetStringUTFChars

843829Dec 2 2003 — edited Dec 9 2003
Hi,

I receive the same error message everytime my C program gets to the GetStringUTFChars statement.

Error = Hotspot virtual Machine Error, EXCEPTION_ACCESS_VIOLATION

Can anyone explain what I'm doing incorrectly in this code?

JNIEXPORT jint JNICALL Java_com_ibm_expedite_expJavaInterface_expDB_ExpJni_jniOpenProject
(JNIEnv *env, jclass cls, jobject obj1, jobject obj2) {

char cap[128];

jfieldID fid = (*env) -> GetFieldID(env, cls, "projectName", "Ljava/lang/String;");

jstring jstr = (*env) -> GetObjectField(env, obj1, fid);
const char str = (env) -> GetStringUTFChars(env, jstr, 0);
strcpy(cap, str);
(*env) -> ReleaseStringUTFChars(env, jstr, str);

Thank you for the expertise!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 6 2004
Added on Dec 2 2003
4 comments
351 views