File directory

1

Hello, I'm doing a program in java where I need to open a file and read it. But when I'm trying to put the file path, it does not find such a file and so I get the Null Pointer Exception error. The code is as follows:

 public File[] returnFiles() 
{
    File f = new File("/tests");
    File[] filesArray = f.listFiles();
    return filesArray;
}

Could someone tell me why I'm not even aware of finding the file in this directory? Note: I'm using the Netbeans IDE, it's supposed to be his problem because it's not being found.

Thanks in advance.

    
asked by anonymous 25.03.2017 / 21:03

0 answers