Reputation: 277
When I use Paths.get() to create a directory I encounter exception below.
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
This happens when I use the workspace of my Windows machine. For linux, it's working fine.
Upvotes: 9
Views: 23317
Reputation: 41
You have /
before C in Your directory path. If you remove it it should work on Windows too.
Paths.get(C:/Users/Desktop/workspaces/sra/emm-be/wsm-kap-api-server/target/test-classes/swagger/swagger.json);
Upvotes: 4
Reputation: 3154
Your directory path contains /
try using
Paths.get("C:\\Users\\Desktop\\workspaces\\sra\\emm-be\\wsm-kap-api-server\\target\\test-classes\\swagger\\swagger.json");
Upvotes: 4