• Post Reply Bookmark Topic Watch Topic
  • New Topic

InvalidPathException  RSS feed

 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paths.get() throws an exception. Java version is 7.

java.nio.file.InvalidPathException: Illegal char <:> at index 2: /c:/a/b/c/d/hai.txt
at
sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.nio.file.Paths.get(Paths.java:84)
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the colon supposed to be in the path? I use Windows so rarely that I have forgotten.
 
Liutauras Vilda
Sheriff
Posts: 4928
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kri shan wrote:/c:/a/b/c/d/hai.txt

Must be that forward slash prior the partition letter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!