0

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,

1 Answer 1

1

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 *

Sign up to request clarification or add additional context in comments.

1 Comment

Note: GetStringChars() returns a pointer to an unterminated sequence of UTF-16 code units (jchar), which is excellent if that's what you want. (You can get the jchar count with GetStringLength.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.