I would like to use JavaFX media player to play mp3 without any GUI.
I saw a lot of examples online, but all of them create JFX Frames.
When I run following code:
protected static void playSong(){
String bip = "file:///c:/a/a.mp3";
Media hit = new Media(bip);
MediaPlayer mediaPlayer = new MediaPlayer(hit);
mediaPlayer.play();
System.out.print(true);
}
I get:
java.lang.IllegalStateException: Toolkit not initialized