폴더가 만들어지지 않았다는 사실에 고민하고 있습니다.새 디렉토리 만들기
private static File createNewTempDir() {
File baseDir = new File(System.getProperty("java.io.tmpdir"));
String baseNamePrefix = System.currentTimeMillis() + "_" + Math.random() + "-";
LOG.info(System.getProperty("java.io.tmpdir"));
File tempDir = new File(baseDir, baseNamePrefix + "0");
LOG.info(tempDir.getAbsolutePath());
tempDir.mkdirs();
if (tempDir.exists()) {
LOG.info("I would be happy!");
}
else {
LOG.info("No folder there");
}
return tempDir;
}
거기에 문제가 있습니까?
이 폴더가 실제로 만들어if (tempDir.exists()) {
LOG.info("I would be happy!");
}
else {
LOG.info("No folder there");
}
, 당신이 경로를 얻어서 있음을 확인하실 수 있습니다 : 나는
폴더가 없습니까? 당신은 그것이 존재할 때만 거기에 기록하지 않습니다. –
문제는 'if (! tempDir.exists())'의 부정이라고 생각됩니다. 그게 "나는 행복 할거야!"라고 인쇄 할 것입니다. 경로가 존재하지 않으면 "No folder there"라고 표시됩니다. –
개미와 어떤 관련이 있습니까? 나는 그것의 사용법을 볼 수 없다. 어쩌면 태그를 제거해야합니다. – joergl