But am a bit confused in the concept of global references.You're not using global references. Your question?
One, should i call some delete reference (or some function like deleteallrefereces (??)[if available]) on JNI_OnUnload?No.
And two is my passing of jboolean argument correct?Yes, but you don't actually need the variable, just pass JNI_FALSE directly as the argument.
should I put JNI_VERSION_1_6Yes, if there is such a thing.
or JNI_VERSION_1_2 will work?Yes.
One, If we create a global reference, and use it in our program, how and when do we delete the reference?When you've finished with it.
When, the answer might be after the reference is no longer in use, but if the reference is used all over the c code, should we delete it manually using DeleteGlobalRef in Unload function?Not really, the entire JVM is being unloaded, it's probably already too late.
Should DeleteLocalRef be called in every method, where the reference might be used?Only if you're trying to limit local references. See the discussion in the JNI Specification. All local references are released when your JNI method exits.
And two, why the codeIt's a local reference, so it's only valid throughout a single JNI call. To reuse across JNI calls, make a GlobalRef or weak global ref out of it, or reacquire it every time you need it.
how will it become invalid when the variable is still used in the same method?It won't. It can become invalid between methods.
The reason i asked this question is, I am using 1.6 version, but am giving 1.2 .. Is it like it will compare with version 1.2 and return true if version is 1.2 or higher?It will return true if it can support that version. It can.