Reputation: 43
can someone help me with this one, im having a error like this
Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 72: D:/Users/cleyeza/Desktop/document/SEC_DOC_SUBMISSION_REPORT_2020-10-0709:54:27+0800.csv
and this is my code
String directoryPath = AppConfig.OUTPUT_PATH.value();
File dir = new File(directoryPath);
if(!dir.exists()){
dir.mkdirs();
}
Writer writer = Files.newBufferedWriter(Paths.get(directoryPath
+"/" +filename+".csv"));
thank you in advance
Upvotes: 0
Views: 4227
Reputation: 8012
You have to remove the colons from your filename SEC_DOC_SUBMISSION_REPORT_2020-10-0709:54:27+0800.csv
. It is a reserved character on Windows and you are not allowed to use any reserved character while naming Files, Paths, and Namespaces.
Checkout the Windows Naming Conventions
Upvotes: 1