简体   繁体   English

线程“main”中的异常 java.nio.file.InvalidPathException:索引 72 处的非法字符 <:>

[英]Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 72

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先感谢您

You have to remove the colons from your filename SEC_DOC_SUBMISSION_REPORT_2020-10-0709:54:27+0800.csv .您必须从文件名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.它是 Windows 上的保留字符,在命名文件、路径和命名空间时不允许使用任何保留字符。 Checkout the Windows Naming Conventions查看Windows 命名约定

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.nio.file.InvalidPathException:索引 2 处的非法字符 <:>: - java.nio.file.InvalidPathException: Illegal char <:> at index 2: gradle-resources-production:mymod.main: java.nio.file.InvalidPathException: Illegal char &lt;:&gt; at index 75 - gradle-resources-production:mymod.main: java.nio.file.InvalidPathException: Illegal char <:> at index 75 遇到java.nio.file.InvalidPathException:非法char &lt;:&gt; - Encountering java.nio.file.InvalidPathException: Illegal char <:> 使用闭包编译器格式化javascript文件时,在索引7处获取到java.nio.file.InvalidPathException:非法char &lt;:&gt; - Got java.nio.file.InvalidPathException:Illegal char <:> at index 7 when formatting javascript file using closure compiler 内部错误(java.nio.file.invalidpathexception):非法字符<!--?-->在索引 34 - internal error (java.nio.file.invalidpathexception): Illegal char <?> at index 34 线程“ main”中的异常java.nio.file.InvalidPathException:UNC路径缺少主机名:/ \\ / - Exception in thread “main” java.nio.file.InvalidPathException: UNC path is missing hostname: /\/ 在尝试编译 java 文件时获取 java.nio.file.InvalidPathException: Illegal char &lt;*&gt; - Getting a java.nio.file.InvalidPathException: Illegal char <*> while trying to compile java files java.nio.file.InvalidPathException - java.nio.file.InvalidPathException java.nio.file.InvalidPathException: Illegal char &lt;"&gt; at index 0: "C:\Program Files\Git\bin\\cl.exe at java.base/sun.nio.fs.WindowsPathParser.normalize - java.nio.file.InvalidPathException: Illegal char <"> at index 0: "C:\Program Files\Git\bin\\cl.exe at java.base/sun.nio.fs.WindowsPathParser.normalize Caused by: java.nio.file.InvalidPathException: Illegal char &lt;:&gt; at index 58: com.example.project.app-mergeDebugResources-32:/values/values.xml - Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 58: com.example.project.app-mergeDebugResources-32:/values/values.xml
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM