code: private void checkDirectory(File d, String dtype) {
  
          if (!d.isAbsolute()) {
              throw new IllegalArgumentException(dtype
                      + " directory must be an absolute path (" + d.getPath() + ")");
          }
          if (!d.exists()) {
              throw new IllegalArgumentException(dtype
                      + " directory does not exist (" + d.getPath() + ")");
          }
          if (!d.isDirectory()) {
              throw new IllegalArgumentException(dtype
                      + " directory value is not a directory (" + d.getPath() + ")");
          }
  
      }
docs: A private utility function to verify that the directory is really a
  directory, exists, and absolute.
  
  @param dirs
  directory to check
  @param dtype
  name to use in case of errors