Hello,
I would like to know if it is possible to create java objects from c++
and sending them back to the Java main application, something like:
JNIEXPORT myJavaObj JNICALL Java_template_getObj
(JNIEnv *env, jobject obj)
{
jclass myClass;
//Somehow, create here the java object..
myClass = (*env)->FindClass(env, "()LMyJavaClass;");
//Create the object somehow...
//Return the object.
return myObj;
}
thanks a lot,
Marcelo
Gordon Beaton - 10 Apr 2006 09:01 GMT
> I would like to know if it is possible to create java objects from c++
> and sending them back to the Java main application
Of course it is. Many of your JNI questions seem to indicate that you
can't be bothered to read any documentation before posting. Here are
two useful links, please follow them:
http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html
http://java.sun.com/docs/books/jni/html/jniTOC.html
Use FindClass. Find the appropriate constructor, i.e. a non-static
method named "<init>". Invoke NewObject.
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e