java获取windows下面的文件对象

Posted 拾荒者

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java获取windows下面的文件对象相关的知识,希望对你有一定的参考价值。


import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
import java.io.File;

FileSystemView fsv = FileSystemView.getFileSystemView();
System.out.println(fsv.getHomeDirectory());
System.out.println(fsv.getDefaultDirectory());
System.getProperties().list(System.out);
File f = fsv.getRoots()[0];
System.out.println(f.getAbsolutePath());
Icon icon = fsv.getSystemIcon(f);
System.out.println(icon.getIconHeight());
System.out.println(icon.getIconWidth());
 











以上是关于java获取windows下面的文件对象的主要内容,如果未能解决你的问题,请参考以下文章