Well, thanks to a colleague I figured it out... The Apple JVM looks
for libraries in
/System/Library/Frameworks/JavaVM.framework/Libraries/ and does not
seem to care about -Djava.library.path or LD_LIBRARY_PATH. There is
probably some environment variable that it does examine, but I stopped
trying to figure it out.
The solution was to:
- Copy built/libxapian_jni.so to
/System/Library/Frameworks/JavaVM.framework/Libraries/libxapian_jni.jnilib
(note the extension)
After that it worked as advertised...
$ java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-113)
Java HotSpot(TM) Client VM (build 1.5.0_06-68, mixed mode, sharing)
$ uname -a
Darwin apollo.local 8.8.2 Darwin Kernel Version 8.8.2: Thu Sep 28
20:43:26 PDT 2006; root:xnu-792.14.14.obj~1/RELEASE_I386 i386 i386
$ java -classpath built/xapian_jni.jar:.
org.xapian.examples.SimpleSearch ./test.db index words like java
Found 4 matching documents using Xapian::Query((index OR words OR like OR java))
25% [1] index
25% [2] words
25% [3] like
25% [4] java
On 2/4/07, John Schult <schulty at gmail.com>
wrote:> I had to make some changes (sorry no diff available) to
"configure" in
> 0.9.9 of the bindings so that I could compile them for OS X 10.4.8.
> Essentially I replaced the the paths to jni.h with
> /System/Library/Frameworks/JavaVM.framework/Headers. It compiled
> without error and created both libxapian_jni.so and xapian_jni.jar in
> the "built" subdirectory when I ran "make install".
>
> When I ran the example code (from the "java" directory) I got the
following:
>
> $ java -Djava.library.path=built -classpath built/xapian_jni.jar:. \
> > org.xapian.examples.SimpleIndex ./test.db index words like java
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no
> xapian_jni in java.library.path
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
> at java.lang.Runtime.loadLibrary0(Runtime.java:822)
> at java.lang.System.loadLibrary(System.java:992)
> at org.xapian.XapianJNI.<clinit>(XapianJNI.java:44)
> at
org.xapian.WritableDatabase.<init>(WritableDatabase.java:42)
> at org.xapian.examples.SimpleIndex.main(SimpleIndex.java:44)
>
> It did not make any difference when I set LD_LIBRARY_PATH to the
> absolute "built" path either. I got the same results. I am
using the
> Apple Java 5 J2SE. Has anyone gotten the bindings to work under OS X?
>
> --
> john david schult
> usa : georgia : buford
> m: 404.510.5163
>
--
john david schult
usa : georgia : buford
m: 404.510.5163