0

hi i need help is there anyone here have the knowledge of java to retrieved files in the folder and print it out
im using this script

File folder = new File("your/path");
File[] listOfFiles = folder.listFiles();

    for (int i = 0; i < listOfFiles.length; i++) {
      if (listOfFiles[i].isFile()) {
        System.out.println("File " + listOfFiles[i].getName());
      } else if (listOfFiles[i].isDirectory()) {
        System.out.println("Directory " + listOfFiles[i].getName());
      }
    }

but the problem is im always seeing this error

500 (access denied (java.io.FilePermission \images\pictures read)) 

can anyone help me thanks

Edited by pritaeas: Moved.

2
Contributors
1
Reply
3
Views
4 Years
Discussion Span
Last Post by Taywin
0

It is obvious that you have no permission to access the folder. You need to check who (user) owns the current folder and what the permission is set to.

PS: A script, to me, means it does not need to be compiled in order to run, such as Perl, Ruby, Python, etc. A snippet or code portion, however, needs to be compiled before it can be used to run.

Edited by Taywin

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.