获取桌面的路径
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
String desktopPath = desktopDir.getAbsolutePath();
在桌面上创建文件
String fileName = desktopPath + "\\文件名.xlsx";
File file = new File(fileName);
File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();
String desktopPath = desktopDir.getAbsolutePath();
String fileName = desktopPath + "\\文件名.xlsx";
File file = new File(fileName);
本文标题:Java 获取当前操作系统桌面路径
本文链接:https://www.haomeiwen.com/subject/mqmrhhtx.html
网友评论