Example usage for org.apache.hadoop.util Shell getQualifiedBinPath

List of usage examples for org.apache.hadoop.util Shell getQualifiedBinPath

Introduction

In this page you can find the example usage for org.apache.hadoop.util Shell getQualifiedBinPath.

Prototype

public static String getQualifiedBinPath(String executable) throws IOException 

Source Link

Document

Fully qualify the path to a binary that should be in a known hadoop bin location.

Usage

From source file:org.apache.slider.common.tools.SliderUtils.java

License:Apache License

/**
 * Check for any needed libraries being present. On Unix none are needed;
 * on windows they must be present//from   w w w  .ja va  2 s.c  om
 * @return true if all is well
 */
public static String checkForRequiredNativeLibraries() {

    if (!Shell.WINDOWS) {
        return "";
    }
    StringBuilder errorText = new StringBuilder("");
    if (!NativeIO.isAvailable()) {
        errorText.append("No native IO library. ");
    }
    try {
        String path = Shell.getQualifiedBinPath("winutils.exe");
        log.debug("winutils is at {}", path);
    } catch (IOException e) {
        errorText.append("No WINUTILS.EXE. ");
        log.warn("No winutils: {}", e, e);
    }
    try {
        File target = new File("target");
        FileUtil.canRead(target);
    } catch (UnsatisfiedLinkError e) {
        log.warn("Failing to link to native IO methods: {}", e, e);
        errorText.append("No native IO methods");
    }
    return errorText.toString();
}