Loading library with absolute path

Lars Andersen lars@rimfaxe.com
Sun Mar 16 13:36:00 GMT 2003


On Sun, 2003年03月16日 at 12:12, Lars Andersen wrote:
>> Using the GCC-20030310 snapshot on linux.
>> I'm trying to load a library using Runtime.load(String filename);
>> This should load the library pointed to by filename :
>> Runtime.load("/home/lars/projects/rws/libservlets.so");
>> However i get an UnsatifiedLinkException :
>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> /home/lars/projects/rws/libservlets.so: 
> libgcj.so.4: cannot open shared object file: No such file or directory
> at java.lang.Runtime._load(java.lang.String, boolean)
> (/home/lars/projects/gcc/libjava/gcj/cni.h:64)
> at java.lang.Runtime.load(java.lang.String)
> (/home/lars/projects/gcc/libjava/java/lang/Runtime.java:624)
>> , and yes, I'm sure that the file exists. 
>> I have also tried adding the directory to LD_LIBRARY_PATH and running :
>> Runtime.load("libservlets.so");
>> with the same result.
>>> /Lars Andersen

OK, found out myself : there was a -static in the compile, preventing it
from loading libs.
Lesson learned ;-)
/Lars Andersen


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /