Eclipse Luna doesn't see the mapped Network drives! Obviously I am able to read any file on the mapped drive.
Here is my test:
public static void main(String[] args) throws
// this part works properly
File myFile = new File("C:\\test.txt");
FileWriter fw = new FileWriter(myFile);
fw.write("test");
fw.close();
//this will throw an exception
myFile = new File("O:\\");
File[] myList = myFile.listFiles();
System.out.println(myList.length);
}
running as a Java application I got:
Exception in thread "main" java.lang.NullPointerException
at variousTest.fileFinder.main(fileFinder.java:28)
I can confirm you that the drive has a big list of folder inside it.
Operating System: Windows 7 Professional SP1
UPDATE I - 10 September:
i tried to run the program outside eclipse, and it i am bewildered about the result, in fact i got this exception:
Exception in thread "main" java.lang.FileNotFoundException: C:\test.txt (Access Denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileWriter.<init>(Unknown Source)
at fileFinder.main(fileFinder.java:14)
UPDATE II - 10 September:
above exception (update I) was raised becouse of rights. The program runs correctly using the directory C:\Users\username\Desktop
O:anddir. This should take care of authorization being done for the Windows user. Then listFiles should no longer return null. (No solution, but to see whether this helps.) - Joop Eggen