So as you read, I'm trying to get some sound working on a main menu of a JavaFX program I am writing. I have put the mp3 I'm trying to play inside of a sounds folder, in a res folder in the project package. Yet when I call it similar to how I call an image for the window, I get an IllegalArgumentException error.
Media menuMusic = new Media("sounds/menu_music.mp3");
menuPlayer = new MediaPlayer(menuMusic);
menuPlayer.setAutoPlay(true);
menuPlayer.setVolume(0.8);
Here is a link to the photo of where the file is stored in the project.
And the error I get:
Caused by: java.lang.IllegalArgumentException: uri.getScheme() == null! uri == 'sounds/menu_music.mp3'
If anyone could help me out it would be much appreciated. I've never worked with Media in JavaFX, so I could be doing this completely wrong for all I know, thanks!