srini_raghav
July 29th, 1999, 10:03 PM
The native method implemented in C is a callback function... Upon some operation(Don't know when the operation will occur) it will call a function..... In that function I have to just close the application.... In that function I don't have env and object parameter.. Do any one know how to tackle this problem...
Thanks lot,
Srini.
unicman
August 1st, 1999, 11:30 AM
If that application is in java, u can use 'System.exit(0);' call to close the application.
- UnicMan
http://members.tripod.com/unicman
ddevienne
September 23rd, 1999, 02:33 PM
Assuming your callback originates from C and you want to call back on the Java side, you can get hold of the JNIEnv pointer using the new GetEnv() function from Java2. GetEnv() is part of the JavaVM interface, a pointer of which is passed upon loading of the DLL to JNI_OnLoad(), an exported function Java2 will call if it exists. This JavaVM is unique and common to all threads, so can be safely cached in a static C variable. To access objects, either you have static Java method you can call that return them to you, or you cache them using NewGlobalRef(), but then there's threading issues. Read Sheng Liang's excellent book. Hope it helps, --DD