I'm trying to downgrade an application from Java 7 to Java 6 for the sake of compatibility. However, with Jave 6's listFiles() I get a NullPointerException for the c drive on Windows machines (and isHidden() returns true). Since Java 7's FileTreeWalker worked nicely, I'd assume it's not a Windows issue, is it? I used this piece of code:
public class Filewalker {
public void walk( String path ) {
File root = new File( path );
File[] list = root.listFiles();
for ( File f : list ) {
if ( f.isDirectory() ) {
walk( f.getAbsolutePath() );
System.out.println( "Dir:" + f.getAbsoluteFile() );
}
else {
System.out.println( "File:" + f.getAbsoluteFile() );
}
}
}
public static void main(String[] args) {
Filewalker fw = new Filewalker();
fw.walk("c:\\" );
}
}
Bob