import java.io.File;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
String bip = "song.mp3";
Media hit = new Media(new File(bip).toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(hit);
mediaPlayer.play();
public void playSound() {
try {
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File("D:/MusicPlayer/fml.mp3").getAbsoluteFile());
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
clip.start();
} catch(Exception e) {
System.out.println("Error with playing sound.");
e.printStackTrace();
}
}