How to copy file in java

后端 未结 6 1886
后悔当初
后悔当初 2021-02-13 18:56

Im trying to copy a file in java and move it to a new folder. This is the code i HAve been using but I always get this error \"(Access is denied) in the specified directory\". I

6条回答
  •  时光说笑
    2021-02-13 19:35

    Edit ups messed up, second try:

    You have to give the FileOutputStream a valid file name, just append the name of your file to the target path C:/users/peter/documents/foldertest2/hats/hat3 with only the folder name it will try to access the folder as if it was a file and fail.

提交回复
热议问题