I'm getting a FileNotFoundException when it's obviously right there. Just look at my screenshot:
Does anyone know what's going on?
I'm getting a FileNotFoundException when it's obviously right there. Just look at my screenshot:
Does anyone know what's going on?
Resources (like your soundfile) shouldn't be in the sourcefolder, but in a separate resources folder. Apart from that: just look at the absolute path of your file, and you might notice it's not the path you think it is.
The answer is that FileInputStream starts at the project folder, and not src. Thank you Soham A! Also thank you Paul for letting me know that resources shouldn't be in the source folder.
The patch to your file is src/sounds/...
and you search in sounds/...
(if your start directory is the project root, which it is by default), this is "obviously" wrong. BTW: I generally recommend you work with new FileInputStream(new File(relName).getAbsoluteFile())
(or similar), because then your exception will actually tell you where it was looking for the file.
Besides it looks like you want to load the resources as resources from the class loader.