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

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

Introduction

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

Prototype

boolean IS_OS_WINDOWS_95

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

Click Source Link

Document

Is true if this is Windows 95.

The field will return false if OS_NAME is null.

Usage

From source file:org.n0pe.asadmin.AsAdmin.java

/**
 * Run the given AsAdmin command./* w ww. j  av a 2s. co m*/
 * 
 * @param cmd AsAdmin command to be run
 * @throws org.n0pe.asadmin.AsAdminException AsAdminException
 */
public void run(final IAsAdminCmd cmd) throws AsAdminException {
    try {
        final File gfBinPath = new File(config.getGlassfishHome() + File.separator + "bin");
        final String[] cmds = buildProcessParams(cmd, config);
        cmds[0] = gfBinPath + File.separator + cmds[0];
        int exitCode;
        final Process proc;
        String[] env = buildEnvironmentStrings(config.getEnvironmentVariables());
        if (SystemUtils.IS_OS_WINDOWS) {
            // Windows
            final String command = "\"\"" + StringUtils.join(cmds, "\" \"") + "\"\"";
            final String[] windowsCommand;
            if (SystemUtils.IS_OS_WINDOWS_95 || SystemUtils.IS_OS_WINDOWS_98 || SystemUtils.IS_OS_WINDOWS_ME) {
                windowsCommand = new String[] { "command.com", "/C", command };
            } else {
                windowsCommand = new String[] { "cmd.exe", "/C", command };
            }
            outPrintln("Will run the following command: " + StringUtils.join(windowsCommand, " "));
            if (env.length > 0) {
                proc = Runtime.getRuntime().exec(windowsCommand, env);
            } else {
                proc = Runtime.getRuntime().exec(windowsCommand);
            }
        } else {
            // Non Windows
            outPrintln("Will run the following command: " + StringUtils.join(cmds, " "));
            proc = Runtime.getRuntime().exec(cmds, env);
        }
        final ProcessStreamGobbler errorGobbler = new ProcessStreamGobbler(cmd, proc.getErrorStream(),
                ProcessStreamGobbler.ERROR);
        final ProcessStreamGobbler outputGobbler = new ProcessStreamGobbler(cmd, proc.getInputStream(),
                ProcessStreamGobbler.OUTPUT);
        errorGobbler.start();
        outputGobbler.start();
        exitCode = proc.waitFor();
        if (exitCode != 0) {
            throw new AsAdminException("asadmin invocation failed and returned : " + String.valueOf(exitCode));
        }
    } catch (final InterruptedException ex) {
        throw new AsAdminException("AsAdmin error occurred: " + ex.getMessage(), ex);
    } catch (final IOException ex) {
        throw new AsAdminException("AsAdmin error occurred: " + ex.getMessage(), ex);
    }
}

From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java

/**
 * Returns <code>true</code> if the OS is Windows, <code>false</code>
 * otherwise./*from w w w. j  ava 2s  . c  om*/
 * 
 * @return See above.
 */
public static boolean isWindowsOS() {
    //String osName = System.getProperty("os.name").toLowerCase();
    //return osName.startsWith("windows");
    return (SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_WINDOWS_2000 || SystemUtils.IS_OS_WINDOWS_7
            || SystemUtils.IS_OS_WINDOWS_95 || SystemUtils.IS_OS_WINDOWS_98 || SystemUtils.IS_OS_WINDOWS_ME
            || SystemUtils.IS_OS_WINDOWS_NT || SystemUtils.IS_OS_WINDOWS_VISTA || SystemUtils.IS_OS_WINDOWS_XP);
}