How come my file isn't being read correctly? I checked, and the res folder is a resource in this project.
public class Testing {
private File file;
private Clip clip;
private AudioInputStream audioIn;
public Testing() {
String path = "/res/shot.mp3";
file = new File(path);
System.out.println(file.toString());
try {
audioIn = AudioSystem.getAudioInputStream(file);
clip = AudioSystem.getClip();
clip.open(audioIn);
clip.start();
} catch(Exception e) {
e.printStackTrace();
}
// java.io.FileNotFoundException: \res\shot.mp3
// (The system cannot find the path specified)
}
public static void main(String[] args) {
new Testing();
}
}
My Package Explorer.
I tried changing the path to /SoundTest/res/shot.mp3
, still no luck. Any ideas?