if (System.getProperty("os.name").startsWith("Mac")) { // do something mac specific System.out.println("hello!"); }