Another interesting class is FileSystemView. It contains information about special files, such as the "Desktop" or "My Computer" node element:
final javax.swing.filechooser.FileSystemView fileSystemView = javax.swing.filechooser.FileSystemView.getFileSystemView(); File[] roots=fileSystemView.getRoots();
you can use this class to check if the file is a node disk or a node floppy disk, and besides using isTraversable you can check for example. empty CD-ROM drives, i.e. existing roots for which File.listFiles () will fail.
source share