Using javah to create JNI interfaces
There are times that you will need to interface with the underlying operating system APIs or you have a dynamic link libraries that needs to be called from Java. It can be done using JNI using the javah tool. First, you will need to create a java class that expose interfaces that you will implement in C. ////////////////////////////////// MyJavaInterfaces.java //////////////////////////////////// public class MyJavaInterfaces{ public MyJavaInterfaces(){ } public native int MyFunction(); static{ System.loadLibrary("MyNativeInterfaces"); } } ////////////////////////////////////////////////////////////////////////////////////////////////////////// The declaration, public native int MyFunction(); is the native function that needs to be implemented in C. The call, System.loadLibrary("MyNativeInterfaces"); is the library that you will cre...