java-native-interface
Java Native Interface 32 bit dll on 64 bit system
You’ll have to install a 32bit JVM and you will be able to run your code. If you are going to distribute your application, you will want to build both 32bit and 64bit versions of your DLL. Then use the following technique to have the proper DLL loaded regardless of your customers arch. Append either … Read more
JNI Calls different in C vs C++?
I used to have the book Essential JNI. And while it is kinda dated (1998), much of it still works today. If I recall correctly, in C, Java constructs are simply pointers. Thus, in your code, (*env)-> is dereferencing pointers to give you access to the underlying methods. For C++, env is actually an object … Read more
jni.h: No such file or directory
Open up a terminal and type: locate jni.h That should tell you where every file called jni.h is on your system. I am on ubuntu 11.04, and it’s located at: /usr/lib/jvm/java-6-openjdk/include/jni.h /usr/lib/jvm/java-6-sun-1.6.0.26/include/jni.h You may also need to get it from the repos: sudo apt-get install openjdk-6-jdk should do the trick if you don’t have it … Read more
How to catch JNI/Java Exception?
if you invoke a Java method from JNI, calling ExceptionCheck afterwards will return JNI_TRUE if an exception was thrown by the Java. if you’re just invoking a JNI function (such as FindClass), ExceptionCheck will tell you if that failed in a way that leaves a pending exception (as FindClass will do on error). ExceptionDescribe outputs … Read more
Why Apache Kafka Streams uses RocksDB and if how is it possible to change it?
RocksDB is used for several (internal) reasons (as you mentioned already for example its performance). Conceptually, Kafka Streams does not need RocksDB — it is used as internal key-value cache and any other store offering similar functionality would work, too. Comment from @miguno below (rephrased): One important advantage of RocksDB in contrast to pure in-memory … Read more
How to access arrays within an object with JNI?
I hope that will help you a little (check out the JNI Struct reference, too): // Get the class jclass mvclass = env->GetObjectClass( *cls ); // Get method ID for method getSomeDoubleArray that returns a double array jmethodID mid = env->GetMethodID( mvclass, “getSomeDoubleArray”, “()[D”); // Call the method, returns JObject (because Array is instance of … Read more