On Fri, Feb 15, 2008 at 09:04:06AM +0100, Martin Thelian
wrote:> is it possible to specify at runtime or via environment variable where
> the libxapian.so is located? The libxapian_jni.so seems to assume that
> libxapian is always installed in a fixed location.
If xapian-core is installed to a prefix which is in the dynamic loader's
standard search path, then libxapian_jni.so expects libxapian to be
found automatically, but if xapian-core is installed elsewhere, then
libtool adds an rpath to libxapian_jni.so which tells it where libxapian
is located. The rpath needs to be a full pathname (for many platform
at least, so libtool always sets it to one for portability).
You don't say what platform you're using, but most Unix-like platforms
provided an environmental variable which you can set to a list of paths
to be searched for shared libraries. Often this is called
LD_LIBRARY_PATH, but some platforms use a different name - you can check
what your platform calls it with this command in your xapian-core source
tree:
./libtool --config|grep ^shlibpath_var
Assuming it is LD_LIBRARY_PATH, and a bourne-like shell:
LD_LIBRARY_PATH=/path/to/where/xapian-core/really/is/lib
export LD_LIBRARY_PATH
<run java program>
I believe you can also pass the option
-Djava.library.path=/path/to/where/xapian-core/really/is/lib when
invoking the java interpreter, but setting the environmental variable
works better if the java interpreter is run implicitly, or inside a
wrapper script you don't want to modify.
Cheers,
Olly