[kaffe] System.loadLibrary() should look in /lib and /usr/lib
Dalibor Topic
robilad at yahoo.com
Sun Jul 27 04:16:02 PDT 2003
Hi Mark,
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.
--- Mark Wielaard <mark at klomp.org> wrote:
> Hi,
>
> 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]);
}
}
here's the output from JDK 1.4.2:
topic at clerks:~> /opt/j2sdk_nb/j2sdk1.4.2/bin/java LibLoad gtk
/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/i386/client:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/i386:/opt/j2sdk_nb/j2sdk1.4.2/jre/../lib/i386
Exception in thread "main" java.lang.UnsatisfiedLinkError: no gtk in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at LibLoad.main(LibLoad.java:5)
but adding the standard library paths to LD_LIBRARY_PATH works:
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib/ /opt/j2sdk_nb/j2sdk1.4.2/bin/java
LibLoad dvdcss
/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/i386/client:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/i386:/opt/j2sdk_nb/j2sdk1.4.2/jre/../lib/i386:/lib:/usr/lib:/usr/local/lib/
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.
cheers,
dalibor topic
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the kaffe
mailing list