Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4280189

loadLibrary() fails to load a shared lib whose path is in java.library.path

XMLWordPrintable

    • generic
    • solaris_7

      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?

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: