The JNI compiler generates a C++ proxy class header file and source file for each Java class or interface that you compile; for example, if you compile A.B.MyClass, the following files are generated:
A_B_MyClass.hpp – C++ proxy class header file.
A_B_MyClass.cpp – C++ proxy class source file.
Sybase recommends that you do not edit these generated files, because any changes you make are overwritten when you re-run the compiler.
If you compile a class using the -native option; for example:
jnicc -native X.Y.MyClass
The JNI compiler generates the following files:
X_Y_MyClassNativeMethods.hpp – C++ native methods class header file.
X_Y_MyClassNativeMethods.cpp – C++ native methods class source file.
To implement the native methods, edit X_Y_MyClassNativeMethods.cpp, and add the code to implement the methods. If you re-run the compiler, the new version of the source file has a .cpp.new suffix. If you add new methods to the Java class, then re-run the compiler, you may want to copy the newly-generated empty methods from X_Y_MyClassNativeMethods.cpp.new to X_Y_MyClassNativeMethods.cpp.
An output file that includes all the header files using #include directives; for example, java_classes.hpp.
An output file that includes all the source files using #include directives; for example, java_classes.cpp.