Java Code Examples for org.apache.commons.lang.SystemUtils#IS_OS_MAC_OSX

The following examples show how to use org.apache.commons.lang.SystemUtils#IS_OS_MAC_OSX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: App.java    From ripme with MIT License 5 votes vote down vote up
/**
 * Where everything starts. Takes in, and tries to parse as many commandline arguments as possible.
 * Otherwise, it launches a GUI.
 *
 * @param args Array of command line arguments.
 */
public static void main(String[] args) throws MalformedURLException {
    CommandLine cl = getArgs(args);

    if (args.length > 0 && cl.hasOption('v')){
        logger.info(UpdateUtils.getThisJarVersion());
        System.exit(0);
    }

    if (Utils.getConfigString("proxy.http", null) != null) {
        Proxy.setHTTPProxy(Utils.getConfigString("proxy.http", null));
    } else if (Utils.getConfigString("proxy.socks", null) != null) {
        Proxy.setSocks(Utils.getConfigString("proxy.socks", null));
    }

    // This has to be here instead of handleArgs because handleArgs isn't parsed until after a item is ripper
    if (cl.hasOption("a")) {
        logger.info(cl.getOptionValue("a"));
        stringToAppendToFoldername = cl.getOptionValue("a");
    }

    if (GraphicsEnvironment.isHeadless() || args.length > 0) {
        handleArguments(args);
    } else {
        if (SystemUtils.IS_OS_MAC_OSX) {
            System.setProperty("apple.laf.useScreenMenuBar", "true");
            System.setProperty("com.apple.mrj.application.apple.menu.about.name", "RipMe");
        }

        Utils.configureLogger();

        logger.info("Initialized ripme v" + UpdateUtils.getThisJarVersion());

        MainWindow mw = new MainWindow();
        SwingUtilities.invokeLater(mw);
    }
}
 
Example 2
Source File: LanguageServerLauncher.java    From solidity-ide with Eclipse Public License 1.0 5 votes vote down vote up
private static CharSequence getOS() {
	if (SystemUtils.IS_OS_LINUX) {
		return "linux";
	} else if (SystemUtils.IS_OS_WINDOWS) {
		return "win32";
	} else if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
		return "macosx";
	} else {
		throw new IllegalArgumentException("Unsupported OS");
	}
}
 
Example 3
Source File: UnixSocketClientProviderStrategy.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Override
protected boolean isApplicable() {
    final boolean nettyDoesSupportMacUnixSockets = SystemUtils.IS_OS_MAC_OSX &&
            ComparableVersion.OS_VERSION.isGreaterThanOrEqualTo("10.12");

    return SystemUtils.IS_OS_LINUX || nettyDoesSupportMacUnixSockets;
}
 
Example 4
Source File: AbstractWatchServiceTest.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() {
    // set the NO_EVENT_TIMEOUT_IN_SECONDS according to the operating system used
    if (SystemUtils.IS_OS_MAC_OSX) {
        NO_EVENT_TIMEOUT_IN_SECONDS = 15;
    } else {
        NO_EVENT_TIMEOUT_IN_SECONDS = 3;
    }
}
 
Example 5
Source File: NettyDockerCmdExecFactory.java    From docker-java with Apache License 2.0 5 votes vote down vote up
@Override
public EventLoopGroup init(Bootstrap bootstrap, DockerClientConfig dockerClientConfig) {
    if (SystemUtils.IS_OS_LINUX) {
        return epollGroup();
    } else if (SystemUtils.IS_OS_MAC_OSX) {
        return kqueueGroup();
    }
    throw new RuntimeException("Unsupported OS");
}
 
Example 6
Source File: CompilationMojoSupport.java    From jspc-maven-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Figure out where the tools.jar file lives.
 */
private URL findToolsJar() throws MojoExecutionException {
    final File javaHome = FileUtils.resolveFile(new File(File.pathSeparator), System.getProperty("java.home"));
    
    final List<File> toolsPaths = new ArrayList<File>();
    
    File file = null;
    if (SystemUtils.IS_OS_MAC_OSX) {
        file = FileUtils.resolveFile(javaHome, "../Classes/classes.jar");
        toolsPaths.add(file);
    }
    if (file == null || !file.exists()) {
        file = FileUtils.resolveFile(javaHome, "../lib/tools.jar");
        toolsPaths.add(file);
    }
    
    if (!file.exists()) {
        throw new MojoExecutionException("Could not find tools.jar at " + toolsPaths + " under java.home: " + javaHome);
    }
    getLog().debug("Using tools.jar: " + file);
    
    final URI fileUri = file.toURI();
    try {
        return fileUri.toURL();
    }
    catch (MalformedURLException e) {
        throw new MojoExecutionException("Could not generate URL from URI: " + fileUri, e);
    }
}