public static boolean executableExists(String executable){
  File directFile=new File(executable);
  if (directFile.exists() && directFile.canExecute()) {
    return true;
  }
  for (  String pathString : getSystemPath()) {
    Path path=Paths.get(pathString);
    if (Files.exists(path.resolve(executable)) && Files.isExecutable(path.resolve(executable))) {
      return true;
    }
  }
  return false;
}

public static boolean executableExists ( String executable ) { File directFile = new File ( executable ) ; if ( directFile . exists ( ) && directFile . canExecute ( ) ) { return true ; } for ( String pathString : getSystemPath ( ) ) { Path path = Paths . get ( pathString ) ; if ( Files . exists ( path . resolve ( executable ) ) && Files . isExecutable ( path . resolve ( executable ) ) ) { return true ; } } return false ; }
check whether an executable exists , either at a specific path ( if a full path is given ) or on the path .
