0

I want to create a File in a specific path into server in Java Program I use FileOutputStream but it doesn't work

FileOutputStream fout = new FileOutputStream(filepath);

the value of filepath is: /home/Folder/bin/QueryGet.sh

message of error is : java.io.FileNotFoundException: \home\Folder\bin\QueryGet.sh (Impossibile trovare il percorso specificato)

I don't know why change "/" in "\" in the path

hamid
  • 11
  • 6
  • You are probably encountering this issue because the server is running under a different account than you are so the /home path is not mapped to the same location on the server's file system – Palamino May 08 '19 at 13:27
  • 2
    Are you running on Windows? Did you verify that the directory exists? – VGR May 08 '19 at 13:27
  • 1
    Possible duplicate of [How do I create a file and write to it in Java?](https://stackoverflow.com/questions/2885173/how-do-i-create-a-file-and-write-to-it-in-java) – Benjamin Urquhart May 08 '19 at 13:27
  • 1
    Windows uses `\ ` as a directory separator, but also accepts `/`. So you're probably trying to create this file in Windows (hence it translates the slash to a backslash) but the folder `C:\home\Folder\bin` does not exist. – DodgyCodeException May 08 '19 at 14:03

0 Answers0