PS: In the recent use of JNI, a write Java a will write C + + feel really annoying. Then in the use of Javah, encountered a little bit of a problem, share to everyone.
Javah is a great tool for generating a C + + file with a. class file that contains the JNI stubs for all local methods in the Java code, that is, those methods that are defined as native. If you are using a JNI stub for a class, and you have defined the class as part of the package, you must fully qualify the name of the class. Feel javah like an anti-compilation tool. Well, that's it.
For example, I was writing a Java file with Eclipse, and then the eclipse compiler generated A. class file in the bin directory, so I decided to enter my folder, Xx/xxxx/xxx inside My. class file, so I followed the instructions, Javah -jni XX.XXXX.XX. Class name, and he prompts me to not find the class file for 'XX.XXXX.XX. Class name '. :
Then exit to the Bin directory, re-enter that command, get the same answer!
Depressed how to solve, and then find the answer, the first to ensure that the directory is the Java package on the upper-level path, if it is the eclipse compiled, then is in the Bin directory, the use of instructions
Javah-classpath. Xx. Xxxx.xxx. CLASSNAME
It's ready!! Note the middle of a separate decimal point! Then you can get the. h file you generated!!
How to use Javah to generate a C + + header file is not found ' XX. Xxxx. Xx. CLASSNAME ' class file