code: public static File findExecutableInSystemPath(String executable) {
          String systemPath = System.getenv("PATH");
  
          // Fast failure if we don't have the PATH defined.
          if (systemPath == null) {
              return null;
          }
  
          String[] pathDirs = systemPath.split(File.pathSeparator);
  
          for (String pathDir : pathDirs) {
              File dir = new File(pathDir);
              if (dir.isDirectory()) {
                  File file = findExecutableInDirectory(executable, dir);
                  if (file != null) {
                      return file;
                  }
              }
          }
          // :-(
          return null;
      }
docs: Tries to find the given executable (specified by its name) in the system's path. It checks for a file having
  one of the extensions contained in {@link #EXECUTABLE_EXTENSIONS}, and checks that this file is executable.
  
  @param executable the name of the program to find, generally without the extension
  @return the file of the program to be searched for if found. {@code null} otherwise.