简体   繁体   English

遇到java.nio.file.InvalidPathException:非法char <:>

[英]Encountering java.nio.file.InvalidPathException: Illegal char <:>

When I use Paths.get() to create a directory I encounter. 当我使用Paths.get()创建目录时遇到。 This is when I use the workspace of my Windows machine. 这是当我使用Windows计算机的工作区时。

java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Users/Desktop/workspaces/sra/emm-be/wsm-kap-api-server/target/test-classes/swagger\swagger.json

For linux, it's working fine. 对于linux,它工作正常。 Any thoughts? 有什么想法吗?

您的目录路径包含/尝试使用

    Paths.get("C:\\Users\\Desktop\\workspaces\\sra\\emm-be\\wsm-kap-api-server\\target\\test-classes\\swagger\\swagger.json");

You have / before C in Your directory path. 您的目录路径中的C之前/ If you remove it it should work on Windows too. 如果删除它,它也应在Windows上运行。

 Paths.get(C:/Users/Desktop/workspaces/sra/emm-be/wsm-kap-api-server/target/test-classes/swagger/swagger.json);

暂无
暂无

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

相关问题 使用闭包编译器格式化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 文件时获取 java.nio.file.InvalidPathException: Illegal char &lt;*&gt; - Getting a java.nio.file.InvalidPathException: Illegal char <*> while trying to compile java files 线程“main”中的异常 java.nio.file.InvalidPathException:索引 72 处的非法字符 <:> - Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 72 java.nio.file.InvalidPathException:索引 2 处的非法字符 <:>: - java.nio.file.InvalidPathException: Illegal char <:> at index 2: java.nio.file.InvalidPathException - java.nio.file.InvalidPathException 内部错误(java.nio.file.invalidpathexception):非法字符<!--?-->在索引 34 - internal error (java.nio.file.invalidpathexception): Illegal char <?> at index 34 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 带有getPath的java.nio.file.InvalidPathException - java.nio.file.InvalidPathException with getPath 系统错误:java.nio.file.InvalidPathException: - SystemError: 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
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM