Example usage for org.apache.commons.lang SystemUtils JAVA_LIBRARY_PATH

List of usage examples for org.apache.commons.lang SystemUtils JAVA_LIBRARY_PATH

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils JAVA_LIBRARY_PATH.

Prototype

String JAVA_LIBRARY_PATH

To view the source code for org.apache.commons.lang SystemUtils JAVA_LIBRARY_PATH.

Click Source Link

Document

The java.library.path System Property.

Usage

From source file:edu.cornell.med.icb.goby.R.GobyRengine.java

/**
 * Create a new goby.// ww w.  java2s .  c om
 */
private GobyRengine() {
    super();

    try {
        // tell REngine not to shutdown the jvm if the native R library cannot be loaded
        System.setProperty("jri.ignore.ule", "yes");

        // Tell R to be verbose if we are debugging
        if (LOG.isDebugEnabled()) {
            Rengine.DEBUG = 42;
            LOG.debug("java.library.path: " + SystemUtils.JAVA_LIBRARY_PATH);
        }

        // just making sure we have the right version of everything
        if (!Rengine.versionCheck()) {
            LOG.warn("Rengine cannot be initialized - java files don't match library version.");
            rengine = null;
            return;
        }

        rengine = Rengine.getMainEngine();
        if (rengine == null) {
            // NOTE: Do not use the default Rengine constructor
            rengine = new Rengine(new String[] { "--no-save" }, false, new RLoggerMainLoopCallback());
            if (!rengine.waitForR()) { // will return false if R is dead
                LOG.warn("Cannot load R");
                rengine = null;
            }
        }
    } catch (UnsatisfiedLinkError e) {
        if (LOG.isWarnEnabled()) {
            LOG.warn("Rengine libraries can not be found", e);
            LOG.warn("java.library.path = " + SystemUtils.JAVA_LIBRARY_PATH);
            final Map<String, String> env = new TreeMap<String, String>(System.getenv());
            for (final Map.Entry<String, String> entry : env.entrySet()) {
                LOG.warn(entry.getKey() + " = " + entry.getValue());
            }
        }
        rengine = null;
    }

    addShutdownHook();
}

From source file:com.yahoo.flowetl.commons.runner.Main.java

/**
 * Gets some useful runtime info as a map of names -> info.
 *//*from www  .j  a  v  a  2s .c o  m*/
private static Map<String, Object> getRuntimeInfo() {
    Map<String, Object> sysInfo = new TreeMap<String, Object>();
    StringBuilder jvminfo = new StringBuilder();
    jvminfo.append("Vendor: ");
    jvminfo.append(SystemUtils.JAVA_VENDOR);
    jvminfo.append(", Version: ");
    jvminfo.append(SystemUtils.JAVA_VERSION + " - " + SystemUtils.JAVA_VM_INFO);
    jvminfo.append(", OS: ");
    jvminfo.append(SystemUtils.OS_NAME + " (" + SystemUtils.OS_VERSION + " : " + SystemUtils.OS_ARCH + ")");
    sysInfo.put(WordUtils.capitalizeFully("jvm"), jvminfo.toString());
    sysInfo.put(WordUtils.capitalizeFully("default charset encoding"), DEF_CHAR_SET.name());
    String netAdd = NetUtils.getLocalAddress();
    if (StringUtils.isEmpty(netAdd)) {
        netAdd = "????";
    }
    String localName = NetUtils.getLocalHostName();
    if (StringUtils.isEmpty(localName)) {
        localName = "????";
    }
    sysInfo.put(WordUtils.capitalizeFully("network"), localName + " at ip address " + netAdd);
    String cPath = SystemUtils.JAVA_CLASS_PATH;
    String linesep = StringEscapeUtils.escapeJava(SystemUtils.LINE_SEPARATOR);
    sysInfo.put(WordUtils.capitalizeFully("classpath"), cPath);
    sysInfo.put(WordUtils.capitalizeFully("jvm home"), SystemUtils.JAVA_HOME);
    sysInfo.put(WordUtils.capitalizeFully("jvm tmpdir"), SystemUtils.JAVA_IO_TMPDIR);
    sysInfo.put(WordUtils.capitalizeFully("jvm libpath"), SystemUtils.JAVA_LIBRARY_PATH);
    sysInfo.put(WordUtils.capitalizeFully("line separator"), linesep);
    sysInfo.put(WordUtils.capitalizeFully("path separator"),
            StringEscapeUtils.escapeJava(SystemUtils.PATH_SEPARATOR));
    sysInfo.put(WordUtils.capitalizeFully("user timezone"), SystemUtils.USER_TIMEZONE);
    sysInfo.put(WordUtils.capitalizeFully("user home"), SystemUtils.USER_HOME);
    sysInfo.put(WordUtils.capitalizeFully("user language"), SystemUtils.USER_LANGUAGE);
    sysInfo.put(WordUtils.capitalizeFully("user name"), SystemUtils.USER_NAME);
    return sysInfo;
}