我正在尝试使用以下内容在我的程序后台播放简单的mp3:
Media med = new Media(getClass().getResource("intro.mp3").toExternalForm());
MediaPlayer mPlayer = new MediaPlayer(med);
mPlayer.play();
intro.mp3文件与其他.class文件一起位于我的软件包的bin文件夹中。
问题是我的程序终止并显示:
Exception in thread "main" java.lang.IllegalStateException: Toolkit not initialized
完整的终止日志如下:
Device "Intel(R) HD Graphics Family" (\\.\DISPLAY1) initialization failed :
WARNING: bad driver version detected, device disabled. Please update your driver to at least version 8.15.10.2302
Exception in thread "main" java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:153)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:148)
at javafx.application.Platform.runLater(Platform.java:52)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:450)
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:365)
at PokerApp.<init>(PokerApp.java:33)
at PokerApp.main(PokerApp.java:105)
有人对问题的原因有任何想法吗?