I have been at this for hours and I really have no idea what to try next. I am writing a program to search the contents of a hard drive and delete certain files for the company I am working for. I have written the program in a .js file and it works perfectly. To improve my Java knowledge I decided to rewrite the same program in Java and I am receiving a very odd error.
When I run the program it correctly traverser my C:\ drive deleting every file I tell it to until it gets to C:\Sun. It searches through the Sun folder and just as it is checking the last file I get a "NullPointerException" error and I can't figure it out to save my life!!
Heres my code:
import java.io.File;
class findIt
{
public static void main (String[] args)
{
System.out.println("Searching in java");
findTheFiles("C:\\", args);
}//main
private static void findTheFiles(String f, String[] toFind)
{
File path = new File(f);
File[] contents = path.listFiles();
Message was edited by:
wrconkling