I want to read a file from a relative path. I've tried the following code
InputStream in = new FileInputStream(".//Audio//w1.wav");
Error:
java.io.FileNotFoundException: .\Audio\w1.wav (The system cannot find the path specified)
I also tried to specify the path as "Audio/w1.wav", "Audio//w1.wav" but it does not work.
How can I get the system to find the file?
The problem seems to be a wrong path. To track that down, start with figuring out where . is. To do so run:
System.out.println(new File(".").getAbsolutePath());
This should print the entire path you're in, beginning with c:\ or / depending on your os.
Now take a look at that folder in the explorer, is everything you expect to be in . in that folder?
\ and / and check file access permissions?If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With