/**
    4MC
    Copyright (c) 2014, Carlo Medas
    BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)

    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this
      list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, this
      list of conditions and the following disclaimer in the documentation and/or
      other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  You can contact 4MC author at :
      - 4MC source repository : https://github.com/carlomedas/4mc

  LZ4 - Copyright (C) 2011-2014, Yann Collet - BSD 2-Clause License.
  You can contact LZ4 lib author at :
      - LZ4 source repository : http://code.google.com/p/lz4/
**/
package com.hadoop.compression.fourmc;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class FourMcNativeCodeLoader {
    private static final Log LOG = LogFactory.getLog(FourMcNativeCodeLoader.class);
    private static boolean nativeLibraryLoaded = false;

    static {
        try {
            //try to load the lib
            System.loadLibrary("hadoop-4mc");
            nativeLibraryLoaded = true;
            LOG.info("Loaded native hadoop-4mc library");
        } catch (Throwable t) {
            LOG.error("Could not load native hadoop-4mc library", t);
            nativeLibraryLoaded = false;
        }
    }

    public static boolean isNativeCodeLoaded() {
        return nativeLibraryLoaded;
    }

}

@@ -2314,13 +2314,12 @@
 LOG.
-error
+warn
 (%22Co
@@ -2380,36 +2380,977 @@
     
-nativeLibraryLoaded = false;
+LOG.info(%22Trying loading from LD_LIBRARY_PATH ...%22);%0D%0A            %0D%0A            //try to load the lib from LD_LIBRARY_PATH if library is not found in java.library.path%0D%0A            //helps application loading the libraries using distributed cache in Hadoop.%0D%0A            String lib = %22hadoop-4mc%22;%0D%0A            String ld_lib_path = System.getenv(%22LD_LIBRARY_PATH%22);%0D%0A            String%5B%5D paths = ld_lib_path.split(%22:%22);%0D%0A            for(int i=0; i%3Cpaths.length; i++) %7B%0D%0A               String p = paths%5Bi%5D;%0D%0A               File x = new File(p, %22lib%22 + lib + %22.so%22);%0D%0A               if (x.exists()) %7B%0D%0A                  System.load(x.getAbsolutePath());%0D%0A                  nativeLibraryLoaded = true;%0D%0A                  break;%0D%0A               %7D%0D%0A            %7D%0D%0A            if(nativeLibraryLoaded) %7B%0D%0A                LOG.info(%22Loaded native hadoop-4mc library%22);%0D%0A            %7D else %7B%0D%0A                 LOG.error(%22Could not load native hadoop-4mc library%22);%0D%0A            %7D
 %0D%0A  

Update FourMcNativeCodeLoader.java