java.io.FileNotFoundException when using RandomAccessFile to create file

mlevit picture mlevit · Aug 30, 2010 · Viewed 9.3k times · Source

I'm encountering a FileNotFoundException when I try to make a file using RandomAccessFile:

RandomAccessFile file = new RandomAccessFile("/test.jpg", "rw");

I don't now how to get around this. It's driving me nuts.

Thanks

Answer

Konstantin Burov picture Konstantin Burov · Aug 30, 2010

Try

RandomAccessFile file = new RandomAccessFile(new File(getFilesDir(), "test.jpg"),
        "rw");