我一直在尝试在一些目录中创建文件,但一直没能弄清楚。
重点是在dir:com.resources.files包中创建文本文件,但我的想法行不通。
public boolean archiveFile() {
//
InputStream str = this.getClass().getResourceAsStream("/com/resources/files/"+Filename.txt
boolean bol = false;
file = new File( str.toString() );
if(!file.exists()) {
try {
file.createNewFile();
bol = true;
} catch (Exception e) {
e.printStackTrace();
}// try-catch
}else {
bol = false;
} // if - else
return bol;
}// archiveFile发布于 2014-09-24 08:17:33
资源不是文件,资源路径也不是目录。考虑这样一种情况,即在不解压的情况下执行WAR文件。
你不能这么做。
https://stackoverflow.com/questions/26006181
复制相似问题