I appreciate that it's convenient to let XCode drive, and Apple's
sample works just fine, but I want to keep my build command-line
driven so it'll work on Windows too.
I have a single class so far with one native method. I've javah'ed
it to create the .h file, implemented with a .c file, and then I
compile with:
There's a fair amount of guesswork in these args -- I've been in Java-
land for 8 years and haven't done serious C since I was in college.
I think I need the "-c" because I'm developing a library and not an
executable (with a main method). The -g and -dynamiclib flags are
things I found on the web... not sure I need them... it was a late
night.
This creates my specified .o file, but I'm not sure if it's any
good. When I try to run Java code to load the library, even with an
explicit reference to the jnilib's path, the linking fails:
cadamson% java -classpath build -Djava.library.path=/Users/cadamson/
dev/materia/native org.jvnet.materia.metadata.TestQTMetaData
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/
cadamson/dev/materia/native/libmateria.jnilib:
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1511)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at org.jvnet.materia.metadata.TestQTMetaData.<clinit>
(Unknown Source)
So, is it obvious what I'm doing wrong, and if not, has anyone put up
a page or other resource for working with JNI on OSX without using
XCode?
Thanks much in advance.
And yes, when I have something useful working, I'll be sharing :-)
--Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden