jni « cast « Java Data Type Q&A

1. Java casting problem - Classloader issues    stackoverflow.com

Here is the simplified version of the problem:

 SomeClass c = (SomeClass) obj.getSomeClassParent()
not always but it happens sometimes to trigger exception
 org.somepackage.SomeClass can't be cast to org.somepackage.SomeClass 
How is ...

2. JNI, cast between jobect and jthrowable    stackoverflow.com

Dear colleagues, I need raise an exception from C++ code. Raised exception must contain text and code of error. So common form:

ThrowNew(jclass clazz, const char *msg)
is not applicable. That is why ...

3. how to cast jbyteArray to a structure?    stackoverflow.com

I am using the JNI between Java and C code to pass a byte[] array from Java to C. In C, the parameter is a jbyteArray, like follows:

jint Java_com_my_example_Class_getResult(jbyteArray ary, ...

4. Type casting a variable from jBoolean to bool    stackoverflow.com

When using JNI to interface between Java and C, javah parses a boolean value in Java to jBoolean in the JNI header file. When I use bool in the C file, ...

5. Passing pointers between C and Java through JNI    stackoverflow.com

I've been storing c pointers in Java through JNI by following the advice of @tulskiy in this post Passing pointers between C and Java through JNI The trick is to cast ...