Bug 18234 - System property java.library.path doesn't get used by System.loadLibrary()
Summary: System property java.library.path doesn't get used by System.loadLibrary()
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-30 20:33 UTC by Mark Wielaard
Modified: 2004-11-06 15:50 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-10-30 23:03:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2004-10-30 20:33:02 UTC
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.
Comment 1 Mark Wielaard 2004-10-30 23:03:34 UTC
Think I found what goes wrong.
We call lt_dlinit after we have set lt_dlsetsearchpath.
Testing a patch.
Comment 2 Mark Wielaard 2004-10-30 23:27:27 UTC
Patch here:
http://gcc.gnu.org/ml/java-patches/2004-q4/msg00393.html
Comment 3 GCC Commits 2004-10-30 23:58:28 UTC
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

Comment 4 Mark Wielaard 2004-10-31 00:07:32 UTC
Fix checked in.