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
  • 7,690
  • 22
  • 114
  • 256
Caleb
  • 420
  • 7
  • 20

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
  • 3
  • 16