Exception in thread “main” java.nio.file.InvalidPathException: Illegal char <:> at index 2:

前端 未结 4 1023
礼貌的吻别
礼貌的吻别 2020-12-15 16:57

I have to copy classpath resource from one package to another.

My program is:

    public static void main(String[] args) throws IOException, URISynta         


        
4条回答
  •  悲&欢浪女
    2020-12-15 18:02

    I had the same issue and got the exception, noticed there was a space in the filename, so I had to trim it. After that, the issue is resolved.

    Path filePath = Paths.get(dirPathStr, newFileName.trim());
    

提交回复
热议问题