java输出txt文件到桌面


private static void outputTxt(String ExportFailStudentMsg){
FileSystemView fsv = FileSystemView.getFileSystemView();
File com=fsv.getHomeDirectory();
System.out.println(com.getPath());
File f=new File(com.getPath()+"\\failmsg.txt");
FileOutputStream fos;
try {
fos = new FileOutputStream(f);
OutputStreamWriter dos=new OutputStreamWriter(fos);
dos.write(ExportFailStudentMsg);
dos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM