标签:
import java.io.File; import javax.swing.filechooser.FileSystemView; /** 显示本地磁盘根盘符,显示桌面路径 */ public class RDDemo { static File[] files; public static void main(String[] args) { FileSystemView sys = FileSystemView.getFileSystemView(); files = sys.getRoots(); System.out.println(files.length); for (int i = 0; i < files.length; i++) { System.out.println(files[i]); } files = File.listRoots(); System.out.println(files.length); for (int i = 0; i < files.length; i++) { System.out.println(files[i] + " -- " + sys.getSystemTypeDescription(files[i])); } } }
标签:
原文地址:http://www.cnblogs.com/softidea/p/4584566.html