private void listFilesRecursively(File file) {
  if (file.isDirectory()) {
    System.err.printf("Directory %s:%n", file.getAbsoluteFile());
    for (File child : file.listFiles()) {
      listFilesRecursively(child);
    }
  } else {
    System.err.printf("File %s%n", file.getAbsoluteFile());
  }

}

public static void main(String[] args) {
  listFilesRecursively(new File("."));
}