Sujith Gunawardhane
Sujith Gunawardhane

Reputation: 1311

How to call a String returning java method from C JNI?

There are many functions available for calling java from C, However there is no function for call String returning java methods. Can someone please advise how I can call string returning java method from C?

    CallBooleanMethod,
    CallBooleanMethodV,
    CallBooleanMethodA,
    CallByteMethod,
    CallByteMethodV,
    CallByteMethodA,
    CallCharMethod,
    CallCharMethodV,
    CallCharMethodA,
    CallShortMethod,
    CallShortMethodV,
    CallShortMethodA,
    CallIntMethod,
    CallIntMethodV,
    CallIntMethodA,
    CallLongMethod,
    CallLongMethodV,
    CallLongMethodA,
    CallFloatMethod,
    CallFloatMethodV,
    CallFloatMethodA,
    CallDoubleMethod,
    CallDoubleMethodV,
    CallDoubleMethodA,
    CallVoidMethod,
    CallVoidMethodV,
    CallVoidMethodA,

Upvotes: 0

Views: 1024

Answers (1)

Ingo Leonhardt
Ingo Leonhardt

Reputation: 9884

You can use CallObjectMethod() and friends. If the JAVA method returns String. then the jobject returned can be cast to jstring and you can use GetStringChars() to obtain a jchar *

Upvotes: 1

Related Questions