The class file 'xx. XXXX. XX. classname' cannot be found in the misunderstanding of how to use Javah to generate C/C ++ header files. gcc cannot find the header file.
PS: Recently, jni is used. It may be a headache to write c ++ in java later. When using javah, I encountered a small problem and shared it with you.
Javah is a great tool, which can be obtained through. class file, and generate the corresponding C ++ file, which contains the JNI stubs of all local methods in java code, that is, the methods defined as native. If you are using a JNI stub of a class and you have defined this class as a part of the package, you must fully define the class name. It seems that javah is like a decompilation tool. Well, that's it.
For example, I compile a java file using eclipse, and then compile and generate a file using eclipse. class file, under the bin directory, So I decisively enter my folder, XX/XXXX/XXX contains my. class file, so I followed the instructions, javah-jni XX. XXXX. XX. class Name. In the result, he prompts that I cannot find 'xx. XXXX. XX. class file. :
So I exited to the bin directory and re-entered the command to get the same answer!
After finding the answer, make sure that the directory is the top-level path of the java package. If it is compiled by eclipse, it is under the bin directory and instructions are used.
javah -classpath . XX.XXXX.XXX.CLASSNAME
That's it !! Note that there is a separate decimal point in the middle! Then you can get the. h file you generated !!