I currently have an LWJGL game with background music. When I run my game in Eclipse everything seems fine. The music also works when I export it as a runnable jar. However, when I put my game on a web server and a client downloads and runs it, the music doesn't play. I initially had the following:
try{
File file = new File ("/Users/me/Documents/workspace/LWJGL-T/src/file.mp3");
FileInputStream fileStream = new FileInputStream (file);
BufferedInputStream bufferStream = new BufferedInputStream (fileStream);
Player player = new Player (bufferStream);
player.play();
}
catch (Exception e){
System.err.println (e.toString());
}
After some research, I found out that FileInputStream shouldn't be used with mp3 files so I implemented the following, which didn't work at all.
InputStream fileStream = this.getClass().getResourceAsStream("/Users/me/Documents/workspace/LWJGL-T/src/file.mp3");
Any help would be appreciated; thank you!