What are possible reasons for java.io.IOException: “The filename, directory name, or volume label syntax is incorrect”

后端 未结 13 1443
一个人的身影
一个人的身影 2020-12-10 02:12

I am trying to copy a file using the following code:

File targetFile = new File(targetPath + File.separator + filename);
...
targetFile.createNewFile();
file         


        
13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 02:59

    A very similar error:- " ... java.io.IOException: The filename, directory name, or volume label syntax is incorrect" was generated in Eclipse for me when the TOMCAT home setting had a training backslash.

    The minor edit suggested at:- http://www.coderanch.com/t/556633/Tomcat/java-io-IOException-filename-directory fixed it for me.

提交回复
热议问题