Missing scheme (IllegalArgumentException) while using java.nio.file.Paths interface

前端 未结 1 1410

this is a really simple java question. I am using Java 8 with eclipse kepler on a linux system. I\'ve been trying to try out NIO.2. My code is:

package lucasTest         


        
1条回答
  •  遥遥无期
    2021-02-14 12:29

    Your uri declaration is missing the scheme for files (file:///):

    u = new URI("file:///./Lucas.java");
    Path p = Paths.get(u);          
    

    should work. As an alternative you can try

     Path p2 = Paths.get(".", "Lucas.java");
    

    0 讨论(0)
提交回复
热议问题