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
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.