0

I would like to make a program that in java using netbeans. I want this program to search through a specified folder and display all files into a text area.

here's what I saw on stackoverflow:

File file = new File("/path/to/directory");
String[] directories = file.list(new FilenameFilter() {
  @Override
  public boolean accept(File current, String name) {
    return new File(current, name).isDirectory();
  }
});
System.out.println(Arrays.toString(directories));

how do I make it better?

Thufir
  • 8,216
  • 28
  • 125
  • 273
Caleb
  • 572
  • 1
  • 7
  • 25

1 Answers1

1
File file=new File("path to your file");   
 Process p = Runtime.getRuntime().exec("RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL " + file.getAbsolutePath());
    p.waitFor();

this code simply opens Files

Adeel Ahmed
  • 413
  • 4
  • 16