有人能帮我解决这个问题吗?我有一个类似的错误
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
这是我的代码
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"));
提前感谢
您必须从文件名SEC_DOC_SUBMISSION_REPORT_2020-10-0709:54:27+0800.csv
中删除冒号。它是Windows上的保留字符,在命名文件、路径和命名空间时不允许使用任何保留字符。检查Windows命名约定