[kaffe] System.loadLibrary() should look in /lib and /usr/lib

Mark Wielaard mark at klomp.org
Sun Jul 27 05:26:02 PDT 2003


On Sun, 2003-07-27 at 13:15, Dalibor Topic wrote:
> sorry for me taking so long to reply, I'm now going though my mailbiox folder
> with patches and suggestion, and noticed I hadn't replied.
> > When doing a System.loadLibrary() kaffe doesn't look into the standard
> > /lib and /usr/lib directories for the library. But gives:
> > 
> > java.lang.UnsatisfiedLinkError: libGTKJava: not found
> > Adding its directory to LD_LIBRARY_PATH may help.
> > 
> > And indeed adding /usr/lib (where the library is installed) to
> > LD_LIBRARY_PATH seems to work, but it would be more convenient if kaffe
> > would automatically load standard libraries (from /lib and /usr/lib).
> I wrote a test case:
> public class LibLoad {
>         public static void main(String [] args) {
>                 String lpath = System.getProperty("java.library.path");
>                 System.out.println(lpath);
>                 System.loadLibrary(args[0]);
>         }
> }
> [...]
> that's the way it works in kaffe, too.
> Given that standard library paths are system dependant (i.e. there is no /lib
> on Win32 ;), I think we should keep doing as JDK does, and use LD_LIBRARY_PATH.
> Unfortunately, the Java Class Library books only specify the search order on
> Win32.

Debian has now defined a standard directory for packages containing JNI
libraries: /usr/lib/jni
(see http://www.debian.org/doc/packaging-manuals/java-policy/c36.html).

It is the job of the Debian okage maintainer to make sure that the VM
works that way and the above LD_LIBRARY_PATH trick seems to make it
possible. Haven't checked yet if the new kaffe package in Debian already
does this. But it might be a good idea to see how this works out for
Debian and maybe adopt this policy (searching for JNI libraries in
/usr/lib/jni by default) for systems that have such a directory.



More information about the kaffe mailing list