doDo the following:
1/ change your java class to
class Hello { public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } } 2/ rename hello.so to libhello.so: "cp hello.so libhello.so" or "mv hello.so libhello.so"
3/ run as: "java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello"
change your Java class to this:
class Hello { public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } }rename hello.so to libhello.so:
cp hello.so libhello.soormv hello.so libhello.sorun as:
java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello