public String find(String named) {
    File file = new File(named);
    if (canExecute(file)) {
      return named;
    }

    if (Platform.getCurrent().is(Platform.WINDOWS)) {
      file = new File(named + ".exe");
      if (canExecute(file)) {
        return named + ".exe";
      }
    }

    addPathFromEnvironment();
    if (Platform.getCurrent().is(Platform.MAC)) {
      addMacSpecificPath();
    }

    for (String pathSegment : pathSegmentBuilder.build()) {
      for (String ending : ENDINGS) {
        file = new File(pathSegment, named + ending);
        if (canExecute(file)) {
          return file.getAbsolutePath();
        }
      }
    }
    return null;
  }
public String find ( String named ) { File file = new File ( named ) ; if ( canExecute ( file ) ) { return named ; } if ( Platform . getCurrent ( ) . is ( Platform . WINDOWS ) ) { file = new File ( named + ".exe" ) ; if ( canExecute ( file ) ) { return named + ".exe" ; } } addPathFromEnvironment ( ) ; if ( Platform . getCurrent ( ) . is ( Platform . MAC ) ) { addMacSpecificPath ( ) ; } for ( String pathSegment : pathSegmentBuilder . build ( ) ) { for ( String ending : ENDINGS ) { file = new File ( pathSegment , named + ending ) ; if ( canExecute ( file ) ) { return file . getAbsolutePath ( ) ; } } } return null ; }
Find the executable by scanning the file system and the PATH. In the case of Windows this
method allows common executable endings (".com", ".bat" and ".exe") to be omitted.

@param named The name of the executable to find
@return The absolute path to the executable, or null if no match is made.