Example usage for org.apache.commons.lang3 SystemUtils IS_OS_LINUX

List of usage examples for org.apache.commons.lang3 SystemUtils IS_OS_LINUX

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SystemUtils IS_OS_LINUX.

Prototype

boolean IS_OS_LINUX

To view the source code for org.apache.commons.lang3 SystemUtils IS_OS_LINUX.

Click Source Link

Document

Is true if this is Linux.

Usage

From source file:gr.aueb.dmst.istlab.unixtools.util.EclipsePluginUtil.java

public static List<String> getSystemShellInfo() {
    List<String> shellInfo = new ArrayList<>();

    if (SystemUtils.IS_OS_LINUX) {
        shellInfo.add("/bin/bash");
        shellInfo.add("-c");
    } else if (SystemUtils.IS_OS_FREE_BSD) {
        shellInfo.add("");
        shellInfo.add("");
    } else if (SystemUtils.IS_OS_WINDOWS) {
        String value = Activator.getDefault().getPreferenceStore().getString(PropertiesLoader.SHELL_PATH_KEY);
        String cygwin = path(value) ? value + "bash.exe" : value + "/bash.exe";
        shellInfo.add("CMD");
        shellInfo.add("/C");
        shellInfo.add(cygwin.replace("\\", "/") + " --login -c ");
    } else if (SystemUtils.IS_OS_MAC_OSX) {
        shellInfo.add("/bin/sh");
        shellInfo.add("-c");
    }/*from  w  ww . j a v a  2 s . c om*/

    return shellInfo;
}

From source file:com.officialgenius.brainiac.Brainiac.java

/**
 * Get Dropbox path of the system/*from  w  w  w .  j  av  a 2  s  .  c  o m*/
 * @return path of dropbox folder
 * @throws IOException
 */

public static String getDropBoxPath() throws IOException {
    Diodable diode = null;
    if (SystemUtils.IS_OS_WINDOWS) {
        diode = new WindowsDiode();
    } else if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC) {
        diode = new NixDiode();
    }
    return diode != null ? diode.getDropBoxPath() : null;
}

From source file:io.kamax.tools.platform.PlatformUtil.java

/**
 * Return one of the given parameters depending on the current platform
 *
 * @param onWin value to be returned if Platform is Windows
 * @param other value to be returned for other platforms
 * @return String/*from www  . ja v a 2 s  . c  om*/
 */
public static String getString(String onLinux, String other) {
    if (SystemUtils.IS_OS_LINUX) {
        return onLinux;
    } else {
        return other;
    }
}

From source file:gr.teicm.pm.smartfilemanager.corelibrary.entity.logic.drives.UnixDriveProperties.java

public UnixDriveProperties() throws Exception {

    if (!SystemUtils.IS_OS_LINUX) {
        throw new Exception("Wrong os");
    }//from   www  .j  av a2 s .  c o m
}

From source file:io.ucoin.ucoinj.elasticsearch.util.Desktop.java

public static DesktopPower getDesktopPower() {
    if (desktopPower == null) {

        if (SystemUtils.IS_OS_WINDOWS) {
            // All Windows version are handled with WindowsPower class
            try {
                desktopPower = new WindowsPower();
            } catch (Exception e) {
                LOG.error(e.getLocalizedMessage(), e);
            }/*from  ww w. j  av a 2s  .  c  om*/

        } else if (SystemUtils.IS_OS_LINUX) {

            // TODO create a Linux/UnixPower because (for example) Kubuntu sends KILL signal when it shutdown, it should sent TERM !!
        }

    }

    return desktopPower;
}

From source file:net.chris54721.infinitycubed.utils.Utils.java

public static File getAppdataPath() {
    if (SystemUtils.IS_OS_WINDOWS)
        return new File(System.getenv("APPDATA"));
    if (SystemUtils.IS_OS_MAC_OSX)
        return new File(System.getProperty("user.home") + "/Library/Application Support");
    if (SystemUtils.IS_OS_LINUX)
        return new File(System.getProperty("user.home"));
    return new File(System.getProperty("user.home"));
}

From source file:alluxio.util.OSUtils.java

/**
 * @return true if current OS is Linux
 */
public static boolean isLinux() {
    return SystemUtils.IS_OS_LINUX;
}

From source file:net.chris54721.infinitycubed.data.Library.java

public static URL getLibraryUrl(String name, String baseUrl, boolean hasNatives) {
    try {/*from   ww w . j  ava2 s.  c  om*/
        String[] sName = name.split(":");
        String path = sName[0].replaceAll("\\.", "/");
        String fileName = sName[1];
        String version = sName[2];
        String nativesString = "";
        if (hasNatives) {
            if (SystemUtils.IS_OS_WINDOWS)
                nativesString = "-natives-windows";
            if (SystemUtils.IS_OS_MAC_OSX)
                nativesString = "-natives-osx";
            if (SystemUtils.IS_OS_LINUX)
                nativesString = "-natives-linux";
        }
        return new URL(baseUrl + path + "/" + fileName + "/" + version + "/" + fileName + "-" + version
                + nativesString + ".jar");
    } catch (Exception e) {
        LogHelper.error("Failed getting library URL", e);
        return null;
    }
}

From source file:com.flowpowered.engine.render.DeployNatives.java

public static void deploy() throws Exception {
    final String osPath;
    final String[] nativeLibs;
    if (SystemUtils.IS_OS_WINDOWS) {
        nativeLibs = new String[] { "jinput-dx8_64.dll", "jinput-dx8.dll", "jinput-raw_64.dll",
                "jinput-raw.dll", "jinput-wintab.dll", "lwjgl.dll", "lwjgl64.dll", "OpenAL32.dll",
                "OpenAL64.dll" };
        osPath = "windows/";
    } else if (SystemUtils.IS_OS_MAC) {
        nativeLibs = new String[] { "libjinput-osx.jnilib", "liblwjgl.jnilib", "openal.dylib" };
        osPath = "mac/";
    } else if (SystemUtils.IS_OS_LINUX) {
        nativeLibs = new String[] { "liblwjgl.so", "liblwjgl64.so", "libopenal.so", "libopenal64.so",
                "libjinput-linux.so", "libjinput-linux64.so" };
        osPath = "linux/";
    } else {/* w  w w . j av a 2 s  .  c o m*/
        throw new IllegalStateException("Could not get lwjgl natives for OS \"" + SystemUtils.OS_NAME + "\".");
    }
    final File nativesDir = new File("natives" + File.separator + osPath);
    nativesDir.mkdirs();
    for (String nativeLib : nativeLibs) {
        final File nativeFile = new File(nativesDir, nativeLib);
        if (!nativeFile.exists()) {
            FileUtils.copyInputStreamToFile(DeployNatives.class.getResourceAsStream("/" + nativeLib),
                    nativeFile);
        }
    }
    final String nativesPath = nativesDir.getAbsolutePath();
    System.setProperty("org.lwjgl.librarypath", nativesPath);
    System.setProperty("net.java.games.input.librarypath", nativesPath);
}

From source file:io.hawkcd.agent.components.taskexecutor.executors.RunOnlyOnLinux.java

@Override
public void run(RunNotifier notifier) {
    if (SystemUtils.IS_OS_LINUX) {
        super.run(notifier);
    }
}