final File tmpDir = new File("C:/TEMP/", zipFile.getName());
if(!tmpDir.mkdir() && tmpDir.exists()) {
System.err.println("Cannot create: " + tmpDir);
System.exit(0);
}
그러나 다음을 사용하면 오류가 발생합니다 (만들 수 없음 : C : \ TEMP \ aZipFile).
final File tmpDir = new File(System.getProperty("java.io.tmpdir"), zipFile.getName());
if(!tmpDir.mkdir() && tmpDir.exists()) {
System.err.println("Cannot create: " + tmpDir);
System.exit(0);
}
완벽하게 작동합니다. 내 문제는 내가 C : \ TEMP를 사용하고 싶습니다. 이것은 제가 작업하고있는 나머지 프로젝트와 일치합니다.
다시 Windows XP 및 JDeveloper IDE에서 Java 1.4를 사용하고 있습니다.
왜 upvote? 이 질문에 대답합니까? – Graviton
예, 문장의 첫 번째 부분은 temp dir을 만들려고합니다. 만들면 true를 반환하고 그렇지 않으면 false를 반환하면이 posibility는 if의 두 번째 부분에서 다룹니다. temp가 존재하지 않고 생성 될 수없는 경우에만 if가 true가되도록 – Telcontar