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

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

Introduction

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

Prototype

boolean IS_OS_WINDOWS

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

Click Source Link

Document

Is true if this is Windows.

The field will return false if OS_NAME is null.

Usage

From source file:br.com.ant.system.app.AntSystemApp.java

public static void main(String[] args) {

    try {//ww  w. j av  a2  s. com
        if (SystemUtils.IS_OS_WINDOWS) {
            UIManager.setLookAndFeel(WindowsClassicLookAndFeel.class.getName());
        } else {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }

        ColoniaFormigasView frame = new ColoniaFormigasView();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] devices = env.getScreenDevices();

        DisplayMode mode = devices[0].getDisplayMode();
        int height = mode.getHeight();
        int width = mode.getWidth();

        frame.setSize(width, height - 30);
        frame.setVisible(true);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:de.uzk.hki.da.sb.SIPBuilder.java

public static void main(String[] args) {

    logger.setLevel(Level.ERROR);

    try {//from w  ww.  j av  a2s.c o m
        if (SystemUtils.IS_OS_WINDOWS)
            System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "CP850"));
        else
            System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        return;
    }

    String mainFolderPath = SIPBuilder.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    String confFolderPath, dataFolderPath;
    try {
        mainFolderPath = URLDecoder.decode(mainFolderPath, "UTF-8");
        confFolderPath = new File(mainFolderPath).getParent() + File.separator + "conf";
        dataFolderPath = new File(mainFolderPath).getParent() + File.separator + "data";
    } catch (UnsupportedEncodingException e) {
        confFolderPath = "conf";
        dataFolderPath = "data";
    }

    if (args.length == 0)
        startGUIMode(confFolderPath, dataFolderPath);
    else
        startCLIMode(confFolderPath, dataFolderPath, args);
}

From source file:de.uzk.hki.da.main.SIPBuilder.java

public static void main(String[] args) {

    TTCCLayout layout = new TTCCLayout();
    layout.setDateFormat("yyyy'-'MM'-'dd' 'HH':'mm':'ss");
    layout.setThreadPrinting(false);/*  w  w  w .j  a  va2  s.c o m*/
    ConsoleAppender consoleAppender = new ConsoleAppender(layout);
    logger.addAppender(consoleAppender);
    logger.setLevel(Level.DEBUG);

    properties = new Properties();
    try {
        properties.load(new InputStreamReader(
                (ClassLoader.getSystemResourceAsStream("configuration/config.properties"))));
    } catch (FileNotFoundException e1) {
        System.exit(Feedback.GUI_ERROR.toInt());
    } catch (IOException e2) {
        System.exit(Feedback.GUI_ERROR.toInt());
    }

    try {
        if (SystemUtils.IS_OS_WINDOWS)
            System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "CP850"));
        else
            System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out), true, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        return;
    }

    String mainFolderPath = SIPBuilder.class.getProtectionDomain().getCodeSource().getLocation().getPath();
    String confFolderPath, dataFolderPath;
    try {
        mainFolderPath = URLDecoder.decode(mainFolderPath, "UTF-8");
        confFolderPath = new File(mainFolderPath).getParent() + File.separator + "conf";
        dataFolderPath = new File(mainFolderPath).getParent() + File.separator + "data";
    } catch (UnsupportedEncodingException e) {
        confFolderPath = "conf";
        dataFolderPath = "data";
    }
    System.out.println("ConfFolderPath:" + confFolderPath);
    if (args.length == 0)
        startGUIMode(confFolderPath, dataFolderPath);
    else
        startCLIMode(confFolderPath, dataFolderPath, args);
}

From source file:com.doculibre.constellio.utils.OSUtils.java

public static boolean isWindows64() {
    boolean windows64;
    if (SystemUtils.IS_OS_WINDOWS) {
        String osArch = System.getProperty("os.arch");
        if (osArch.indexOf("64") != -1) {
            windows64 = true;// w  w  w  . jav  a  2s  .  c  om
        } else {
            windows64 = false;
        }
    } else {
        windows64 = false;
    }
    return windows64;
}

From source file:com.vmware.identity.interop.FileSystemPathLocator.java

public static String getCacheFolderPath() {
    String cacheDirPath = null;/*from   ww w .  java 2  s.  co  m*/

    if (SystemUtils.IS_OS_WINDOWS) {
        cacheDirPath = Shell32Util.getFolderPath(ShlObj.CSIDL_LOCAL_APPDATA);
    } else {
        cacheDirPath = LINUX_CACHE_FOLDER_ROOT;
    }

    if (cacheDirPath == null || cacheDirPath.isEmpty()) {
        throw new IllegalStateException("Found empty cache dir path");
    }

    return String.format("%s%s%s%s%s", cacheDirPath, SystemUtils.FILE_SEPARATOR, VMWARE_FOLDER_NAME,
            SystemUtils.FILE_SEPARATOR, VMWARE_IDENTITY_FOLDER_NAME);
}

From source file:com.igormaznitsa.mindmap.model.MMapURITest.java

private static void assumeWindows() {
    assumeTrue(SystemUtils.IS_OS_WINDOWS);
}

From source file:com.igormaznitsa.mindmap.model.MMapURITest.java

private static void assumeNotWindows() {
    assumeFalse(SystemUtils.IS_OS_WINDOWS);
}

From source file:de.pawlidi.openaletheia.utils.AletheiaUtils.java

/**
 * Returns current mac adress/*from   w  ww  .  ja v a2  s. c  o m*/
 * 
 * @return macAdress
 */
public static String getMacAddress() {
    String macAddress = getJavaNetMacAddress();
    if (macAddress == null) {
        if (SystemUtils.IS_OS_WINDOWS) {
            macAddress = getWindowsMacAddress();
        } else if (SystemUtils.IS_OS_LINUX) {
            macAddress = getLinuxMacAddress();
        }
        if (macAddress == null) {
            throw new RuntimeException("Cannot read MAC address in operating system");
        }
    }
    macAddress = normalizeMacAddress(macAddress);
    return macAddress;
}

From source file:com.googlecode.t7mp.util.SystemUtilTest.java

@Test
public void testSystemUtil() {
    Assert.assertEquals(SystemUtils.IS_OS_WINDOWS, SystemUtil.isWindowsSystem());
}

From source file:com.triage.radium.testweb.RuntimeExecServlet.java

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    String listCommand = "ls";
    PrintWriter out = resp.getWriter();

    if (SystemUtils.IS_OS_WINDOWS) {
        listCommand = "dir";
    }/* www  .  j  ava 2  s .c  o  m*/
    try {
        String output = new ExecCommand().executeCommand(listCommand);
        out.println("SUCCESS");
        out.println(output);
    } catch (Exception e) {
        out.println("ERROR");
        e.printStackTrace(out);
    }

}