When compiling the following program with gcj -Djava.library.path=/usr/lib/jni --main t t.java does print that java.library.path is set to /usr/lib/jni, but this value isn't used to actually load a library in the next statement. When defining the environment variable LD_LIBRARY_PATH a library in /usr/lib/jni can be found. public class t { public static void main(String[] args) { System.out.println(System.getProperty("java.library.path")); System.loadLibrary(args[0]); } } Also setting GCJ_PROPERTIES=java.library.path=/usr/lib/jni doesn't work.
Think I found what goes wrong. We call lt_dlinit after we have set lt_dlsetsearchpath. Testing a patch.
Patch here: http://gcc.gnu.org/ml/java-patches/2004-q4/msg00393.html
Subject: Bug 18234 CVSROOT: /cvs/gcc Module name: gcc Changes by: mark@gcc.gnu.org 2004-10-30 23:58:26 Modified files: libjava : ChangeLog libjava/java/lang: Runtime.java Log message: PR libgcj/18234 * java/lang/Runtime.java (static): Call init(). (Runtime): Remove call to init(). (init): Make static. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3174&r2=1.3175 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/Runtime.java.diff?cvsroot=gcc&r1=1.17&r2=1.18
Fix checked in.