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!

Get/ReleaseStringUTFChars

843829Mar 27 2002 — edited Mar 27 2002
From a Java method "Connection_Open" I am trying to call a C function "Open" which has two strings as input parameters, and returns a connection number as an output parameter:

JNIEXPORT jint JNICALL
Java_Connection_Open(JNIEnv *env, jobject obj, jstring jhostname, jstring jfilename, jint interval)
{
const char chostname = (env)->GetStringUTFChars(env, jhostname, 0);
const char cfilename = (env)->GetStringUTFChars(env, jfilename, 0);
int connection = -1;
Open(chostname, cfilename, &connection, interval);
(*env)->ReleaseStringUTFChars(env, jhostname, chostname);
(*env)->ReleaseStringUTFChars(env, jfilename, cfilename);
return connection;
}

When I run my code in UNIX I get the following errors:
ld.so.1: java: fatal: /usr/local/lib/libJavaC.so: required mapping 0x10000 size 0x14000, is already in use by file java (/usr/local/lib/libJavaC.so)
java.lang.UnsatisfiedLinkError: no JavaC in shared library path

I am guessing that the UnsatisfiedLinkError occurs because of the mapping problem with libJavaC.so, but I don't know why the mapping problem occurs.

Am I doing something wrong with creating and disposing of the UTFString(s)?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 24 2002
Added on Mar 27 2002
3 comments
301 views