Look through the
method you are using, and see under which circumstances it returns
null.
Try creating a file object representing your C drive, and see what its properties are, for example whether it counts as a directory. Try
System.out.println(new File("C:")); and see whether that gives you the information you require.