class HelloWorld { public native void displayHelloWorld();//定义本地方法 static { System.loadLibrary("hello");//调入本地库 } public static void main(String[] args) { new HelloWorld().displayHelloWorld(); }}
Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1410) at java.lang.Runtime.loadLibrary0(Runtime.java:772) at java.lang.System.loadLibrary(System.java:832) at HelloWorld.<clinit>(HelloWorld.java:5)