Hey guys,
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
Hey guys,
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
From the documentation:
FileNotFoundException - if the mode is "r" but the given file object does not denote an existing regular file, or if the mode begins with "rw" but the given file object does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file
Are you able to create such a file by other means? Are you working in an environment where "/" denotes the root directory?
Try
RandomAccessFile file = new RandomAccessFile(new File(getFilesDir(), "test.jpg"), "rw");