[kaffe] JNI load

Helmer Krämer hkraemer at freenet.de
Fri Dec 20 08:59:13 PST 2002

On Fri, 20 Dec 2002 15:50:24 +0100
Richard Stahl <richard.stahl at imec.be> wrote:


> I am sorry yet I again have a problem with the cvs version of kaffe 
> which I do not have with the release version!
> I am using JNI, so I used to specify the LD_LIBRARY_PATH to the place 
> where I have e.g. libMeta.so for class Meta.java ... (this works for the 
> release version!) yet it does not load the library and prints:
> java.lang.ExceptionInInitializerError: [exception was 
> java.lang.UnsatisfiedLinkError: libMeta: not found]
>          at demo.main(demo.java:20)
> java.lang.UnsatisfiedLinkError: libMeta: not found
>          at java.lang.Throwable.fillInStackTrace(Throwable.java:native)
>          at java.lang.Throwable.<init>(Throwable.java:38)
>          at java.lang.Error.<init>(Error.java:81)
>          at java.lang.LinkageError.<init>(LinkageError.java:21)
>          at 
> java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:21)
>          at java.lang.Runtime.loadLibrary(Runtime.java:151)
>          at java.lang.System.loadLibrary(System.java:249)
>          at Meta.<clinit>(Meta.java:25)
>          at demo.main(demo.java:20)
> Could you please give me some hints how to fix it.

I encountered the same  problem a few  days ago but
somehow didn't get around to send patches, sorry :(

When loading native libraries,  kaffe appends a few
different extensions to the name that was passed to
System.loadLibrary () and checks whether libtool is
able to load that file. What happens now is that
kaffe doesn't try the extension ".so" anymore since
the new libtool version (1.4.3) does not export the
autoconf macros necessary to figure out that ".so"
is the extension of dynamic libraries.

I've solved this by applying external.patch, so that
kaffe doesn't append the extensions itself but rather
lets libtool do that (by calling lt_dlopenext).

The next attached patch (libltdl.patch) is necessary
because lt_dlopenext contains a bug that prevents it
from trying to load  non-libtool libraries (the same
patch has been applied to libtool cvs  about 8 weeks

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libltdl.patch
Type: application/octet-stream
Size: 988 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20021220/93b2474c/attachment-0006.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: external.patch
Type: application/octet-stream
Size: 3116 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20021220/93b2474c/attachment-0007.obj 

More information about the kaffe mailing list