1
Я только начал использовать apache commons vfs 2.0. Я пытался получить список файлов из папки в c:\
, но получил ошибку с c:\document and setting
. Вот код:org.apache.commons.vfs2.FileNotFolderException errot, перемещающийся через папку с использованием общих ресурсов vfs 2.0
FileSystemManager fsm = VFS.getManager();
FileObject fo=fsm.resolveFile("c:\\");
FileObject[] fos=fo.getChildren();
for(FileObject f:fos){
FileType ft=f.getType();
if(f.getType().equals(FileType.FOLDER)){
for(FileObject fc:f.getChildren()){
System.out.println(fc.getName().getPath());
}
}
}
Ошибка:
org.apache.commons.vfs2.FileNotFolderException: Could not list the contents of "file:///c:/Documents and Settings" because it is not a folder.
at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:693)
at mypack.gui.FileExplorer.<init>(FileExplorer.java:31)
at mypack.gui.FileExplorer.main(FileExplorer.java:42)