if (!file.exists()) //判断文件是否存在,!file.exists()条件是说文件不存在。 try { file.createNewFile(); // 不存在就创建 } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
应该是没有在项目中导入 dom4j 的 jar 包