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

Java 7 java.library.path no longer includes shared library directories on Linux.

    XMLWordPrintable

Details

    • x86
    • linux_redhat_5.0

    Description

      FULL PRODUCT VERSION :
      > /usr/java/jdk1.7.0_03/bin/javac -version
      javac 1.7.0_03
      > /usr/java/jdk1.7.0_03/bin/java -version
      java version "1.7.0_03"
      Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
      Java HotSpot(TM) Server VM (build 22.1-b02, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux xxxxxxxx 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      > cat /etc/issue
      Red Hat Enterprise Linux Server release 5.8 (Tikanga)
      Kernel \r on an \m
      > echo $LD_LIBRARY_PATH
      LD_LIBRARY_PATH: Undefined variable.


      A DESCRIPTION OF THE PROBLEM :
      The Java 7 java.library.path system property no longer includes the paths to the directories containing the Java shared libraries on Linux. It did in Java 6.


      REGRESSION. Last worked in version 6u29

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create LibraryPathPrinter.java as indicated below:

      public class
      LibraryPathPrinter
      {
         public static void
         main( String[] args)
         {
            String libPath = System.getProperty( "java.library.path");
            if( libPath != null) {
               System.out.println( libPath);
            }
            System.exit( 0);
         }
      }

      Compile and run as follows:

      /usr/java/jdk1.7.0_03/bin/javac LibraryPathPrinter.java
      /usr/java/jdk1.7.0_03/bin/java LibraryPathPrinter
      /usr/java/jdk1.7.0_03/jre/bin/java LibraryPathPrinter
      /usr/java/jdk1.6.0_29/bin/javac LibraryPathPrinter.java
      /usr/java/jdk1.6.0_29/bin/java LibraryPathPrinter
      /usr/java/jdk1.6.0_29/jre/bin/java LibraryPathPrinter

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A value of java.library.path containing a similar set of shared library directories as returned by the Java 6 runs of the program.
      ACTUAL -
      > cat LibraryPathPrinter.java
      public class
      LibraryPathPrinter
      {
         public static void
         main( String[] args)
         {
            String libPath = System.getProperty( "java.library.path");
            if( libPath != null) {
               System.out.println( libPath);
            }
            System.exit( 0);
         }
      }
      > /usr/java/jdk1.7.0_03/bin/javac LibraryPathPrinter.java
      > /usr/java/jdk1.7.0_03/bin/java LibraryPathPrinter
      /usr/java/packages/lib/i386:/lib:/usr/lib
      > /usr/java/jdk1.7.0_03/jre/bin/java LibraryPathPrinter
      /usr/java/packages/lib/i386:/lib:/usr/lib
      > /usr/java/jdk1.6.0_29/bin/javac LibraryPathPrinter.java
      > /usr/java/jdk1.6.0_29/bin/java LibraryPathPrinter
      /usr/java/jdk1.6.0_29/jre/lib/i386/server:/usr/java/jdk1.6.0_29/jre/lib/i386:/usr/java/jdk1.6.0_29/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
      > /usr/java/jdk1.6.0_29/jre/bin/java LibraryPathPrinter
      /usr/java/jdk1.6.0_29/jre/lib/i386/server:/usr/java/jdk1.6.0_29/jre/lib/i386:/usr/java/jdk1.6.0_29/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class
      LibraryPathPrinter
      {
         public static void
         main( String[] args)
         {
            String libPath = System.getProperty( "java.library.path");
            if( libPath != null) {
               System.out.println( libPath);
            }
            System.exit( 0);
         }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Write a wrapper function, add the expected set of directories to the path and return that new path. Setting LD_LIBRARY_PATH or explicitly setting -Djava.library.path also work but are not acceptable in our current application.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: