I read a lot about how to use the javah command on the Internet, but none of them are correct. I tried it a few days ago and finally got it done. The main JDK version is jdk1.7.0 _ 21. The usage is as follows:
1. declare that the java_home environment variable is c: \ Program Files \ Java \ jdk1.7.0 _ 21 The java_home environment variable may be Program So it is better to declare it separately. JDK main directory 2. Add the % java_home % \ bin directory to the path. This setting allows the system to find the javah execution File 3. Set the classpath environment variable. This variable is automatically searched during javah execution. Although you can set it manually each time, it is better to set it as an environment variable .. Indicates the current directory. 4. Compile an android project in Android This project is used as an example to organize documents
The native function is declared in the nativesurf class.
The compiled class file is located in copy of opencv \ bin \ Classes.
Note: when using the native method, you must create a separate package and Class. Do not add other classes. Otherwise, the system will prompt that the class cannot be found.
5. Open the command prompt in the copy of opencv \ bin \ Classes directory and use javah <package name. Complete Class Name> to generate a native. h file under classes.
The generated header file is organized as follows:
The header file is successfully generated.