In this java tutorial, I discuss how to solve the refactoring problem we have when working with JNI. Refactoring refers to moving a java class that has a native method from one package to another or renaming the class. In either case, the header files generated by the javah have to change. In order to avoid this, we can use the approach described in this tutorial.