I am trying to play a song (mp3 file) in java. I look around for several hours, and none of the ways I found worked correctly.
public void play() { String song = "song.mp3"; Media track = new Media(song); MediaPlayer mediaPlayer = new MediaPlayer(track); mediaPlayer.play(); }
I tried this, but it gives me errors.
I have imported JMF and JLayer .
I also read other questions like this one on this forum, and none of them helped me.
I just need a hand to help play the mp3 file.
source share