【发布时间】:2013-11-24 04:59:38
【问题描述】:
我设置了一个计时器来调用一个包含 pdf 生成代码的类。我已经设置了需要保存它的文件路径..但是它显示异常为 java.io.FileNotFoundException : D:\ (系统找不到指定的路径)。我不知道错误在哪里..
这是我的代码..
try {
OutputStream file = new FileOutputStream(new File("D://"));
Document document = new Document();
//PDF generating code..
document.add(list); //In the new page we are going to add list
document.close();
file.close();
System.out.println("Pdf created successfully..");
} catch (Exception e) {
e.printStackTrace();
}
【问题讨论】:
-
文件名在哪里?? (new File("D://")) 也应该有文件名
标签: java io file-handling