簡體   English   中英

如何修復 UnsatisfiedLinkError?

[英]How to fix UnsatisfiedLinkError?

我想使用我的本地聲音文件之一來提供背景音樂,但我收到以下錯誤消息:

引起:java.lang.UnsatisfiedLinkError:無法加載庫:C:\Program Files\Amazon Corretto\jdk1.8.0_232\jre\bin\glib-lite.dll

但是我的代碼如下:

 public class DungeonGUI extends Application { private Dungeon dungeon; private Stage stage; private GridPane root; private Button attack; private Button heal; // private Button checkInventory; private Button save; private Text characterHealth; private Text characterPower; private Text characterInventory; private Text monsterHealth; private Text monsterPower; private File audioFile = new File("C:/Users/15774/Downloads/oof.mp3"); @Override public void start(Stage stage) throws Exception { setButtons(); dungeon = new Dungeon(); setTexts(); this.stage = stage; root = new GridPane(); heal.setOnAction(this::onHeal); attack.setOnAction(this::onAttack); save.setOnAction(this::onSave); stage.setTitle("Dungeone Dungeon"); root.setAlignment(Pos.CENTER); setMedia(); setupRoot(); setStage(stage); } private void setMedia() { Media media = new Media(audioFile.toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay(true); }

如您所見,我在任何時候都沒有調用程序文件。 可能是什么問題?

PS:這只是我的代碼的一部分。 如果你們需要更多信息,請發表評論。

我希望使用我的本地聲音文件之一來提供背景音樂,但我收到以下錯誤消息:

引起:java.lang.UnsatisfiedLinkError: Can't load library: C:\\Program Files\\Amazon Corretto\\jdk1.8.0_232\\jre\\bin\\glib-lite.dll

但我的代碼如下:

 public class DungeonGUI extends Application { private Dungeon dungeon; private Stage stage; private GridPane root; private Button attack; private Button heal; // private Button checkInventory; private Button save; private Text characterHealth; private Text characterPower; private Text characterInventory; private Text monsterHealth; private Text monsterPower; private File audioFile = new File("C:/Users/15774/Downloads/oof.mp3"); @Override public void start(Stage stage) throws Exception { setButtons(); dungeon = new Dungeon(); setTexts(); this.stage = stage; root = new GridPane(); heal.setOnAction(this::onHeal); attack.setOnAction(this::onAttack); save.setOnAction(this::onSave); stage.setTitle("Dungeone Dungeon"); root.setAlignment(Pos.CENTER); setMedia(); setupRoot(); setStage(stage); } private void setMedia() { Media media = new Media(audioFile.toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay(true); }

如您所見,我在任何時候都沒有調用程序文件。 可能是什么問題?

PS:這只是我代碼的一部分。 如果你們需要更多信息,請發表評論。

用於 Java 8 的 Amazon Corretto 不支持 JavaFX。請參閱此處了解完整信息。 但是,簡而言之,我參考了頁面中的以下引述:

使用 JavaFX 的推薦方法是使用 Corretto 11 並單獨引入 OpenJFX,例如使用 Maven 依賴項。 最新版本(目前是14)兼容Corretto 11. src: Corretto's github

jccampanero也在這里回答了類似的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM