public static void openFolder(File file) throws P5ExportException {
    boolean error = false;
    String launcher = Preferences.get("launcher");
    String folder = file.getAbsolutePath();
    if (launcher != null) {
      try {
        Runtime.getRuntime().exec(new String[] { launcher, folder });       
      }
      catch (IOException e) {
        System.err.println(e.getMessage());
        error = true;      
      }
    }
    else if (Base.isMacOS()) {
      openMacURL(folder);
    }
    else if (Base.isWindows()) { // launcher == null
      try {
        Runtime.getRuntime().exec("explorer \"" + folder + "\"");       
      }
      catch (IOException e) {
        System.err.println(e.getMessage());
        error = true;      
      }
    }
    else {
      error = true;
    }
    if (error) {
      throw new P5ExportException( 
          "Unspecified platform, no launcher available.\n" + 
          "To enable opening URLs or folders, add a \n" +
          "\"launcher=/path/to/app\" line to preferences.txt");
    }
  }