g++ -m64 -c -I/System/Library/Frameworks/JavaVM.framework/Headers Foo.cpp
g++ -m64 -dynamiclib -o libfoojni.jnilib Foo.o -framework JavaVM
Without the -m64 argument you will receive the unintuitive error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /development/sandbox/libfoojni.jnilib:
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at Foo.(Foo.java:7)
No comments:
Post a Comment