Here you can find the source of isWindowsCygwin()
private static boolean isWindowsCygwin()
//package com.java2s; //License from project: Apache License import static java.util.Arrays.asList; import java.io.File; public class Main { private static boolean isWindowsCygwin() { return System.getProperty("os.name").toLowerCase().contains("windows") && (findCygwinHome() != null); }/*from w w w.j a va2 s . c o m*/ private static String findCygwinHome() { if (System.getProperties().containsKey("cygwin.home")) { return (System.getProperty("cygwin.home") + "\\bin\\bash.exe").replaceAll("//", "/").replaceAll("\\\\", "\\"); } else if (System.getenv("CYGWIN_HOME") != null && System.getenv("CYGWIN_HOME").trim().length() > 0) { return (System.getenv("CYGWIN_HOME") + "\\bin\\bash.exe").replaceAll("//", "/").replaceAll("\\\\", "\\"); } else { for (String candiate : asList("C:\\cygwin_x64\\bin\\", "C:\\cygwin_x86\\bin\\", "C:\\cygwin\\bin\\")) { if (new File(candiate).isDirectory()) { return candiate; } } throw new UnsupportedOperationException("on windows and no cygwin found"); } } }