1. Write a Java class with natively declared methods
2. Use the javac command to compile the Java class written
3. Use java -jni className to generate a header file with a .h suffix
4. Implement native methods in other languages (C, C++)
5. Generate a dynamic link library from the file written by the local method
Code: (without package path)
/**
* native-0study
*
* @author xuedui.zhao
* @create 2018-04-23
*/
public class HelloWorld {
public native void hello();
static{
System.loadLibrary("hello");
}
public static void main(String[] args){
new HelloWorld().hello();
}
}