Do you mean prints nothing, or just "c:"? Because your code just seems to print the results of the listRoots. You do call listFiles, but you do nothing with it.
JamesCherrill
Posting Genius
6,337 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,070
Rather than the pre-1.5 old-style for loops and un-typed lists, replace
ArrayList arrayList = new ArrayList();
File[] files= f.listFiles(); // get all files under the direcrory
for(int index = 0; index < files.length; index++)
{
System.out.println ("here we are---"+files[index].getName());
arrayList.add(files[index].getName());
}
with
ArrayList arrayList<File> = new ArrayList<File>();
for(File ff : f.listFiles()) {
System.out.println ("here we are---"+ff.getName());
arrayList.add(ff.getName());
}
JamesCherrill
Posting Genius
6,337 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,070