United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4280189 : loadLibrary() fails to load a shared lib whose path is in java.library.path

Details
Type:
Bug
Submit Date:
1999-10-12
Status:
Closed
Updated Date:
2012-11-02
Project Name:
JDK
Resolved Date:
1999-10-13
Component:
hotspot
OS:
solaris_7
Sub-Component:
runtime
CPU:
generic
Priority:
P3
Resolution:
Not an Issue
Affected Versions:
1.2.1
Fixed Versions:

Related Reports

Sub Tasks

Description
System.loadLibrary() cannot load a shared library, even if the java.library.path is specified correctly, containing a path to the shared library. The following is a code sequence:

   static {
      String scPath = System.getProperty("java.library.path");
      scPath = scPath.concat(":/scratch/gemeyer/ms7/src/DXF");
      System.setProperty("java.library.path", scPath );
      System.out.println("Library Path is " +
                         System.getProperty("java.library.path"));
      System.loadLibrary("SdrcDxfLoader");
   }

The output looks like this:
SUN82:/scratch/gemeyer/ms7/src/DXF:160$ java DxfLoader
Library Path is
/usr/java/bin/../jre/lib/sparc:/scratch/gemeyer/ms7/src/DXF
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
SdrcDxfLoader in java.library.path
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.<init>(Throwable.java:94)
        at java.lang.Error.<init>(Error.java:50)
        at java.lang.LinkageError.<init>(LinkageError.java:43)
        at
java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:42)
        at java.lang.ClassLoader.loadLibrary(Compiled Code)
        at java.lang.Runtime.loadLibrary0(Runtime.java:471)
        at java.lang.System.loadLibrary(System.java:745)
        at <Unloaded Method>


If LD_LIBRARY_PATH is set, the program works.

Is this a usage problem or bug?


                                    

Comments
EVALUATION


Sorry, this just isn't supposed to work that way.  Like most System properties,
java.library.path is intended to be read-only.  We need to document this better.
                                     
2004-06-11



Hardware and Software, Engineered to Work Together