I'm trying to stream a .wav file. I'm getting this error:
java.io.FileNotFoundException: \sounds\player-bullet.wav (The system cannot find the file specified)
The file structure is src/sounds/player-bullet.wav. The java file is in src. This is the code:
AudioInputStream ais = AudioSystem.getAudioInputStream(new File("/sounds/player-bullet.wav"));
But in the same file I load an image with this code and it works:
shipImage = new Image("/images/player.png");
The file structure is src/images/player.png. This code works in eclipse:
AudioInputStream ais = AudioSystem.getAudioInputStream(new File("./src/sounds/player-bullet.wav"));
But when I make it into a jar file, the src file isnt included. So this won't work when the file is in a jar.