1

I wish to use one of my local sound files to provide background music, but I get this error message:

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

But my code is as follow:

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);
    }

As you can see I did not call program files at any time. What might be the problem?

P.S.: this is only part of my code. If you guys need more information just shoot a comment.

Twoface
  • 21
  • 5

1 Answers1

0

Amazon Corretto for Java 8 does not support JavaFX. See here for full insight. However, as short, I refer to the following quote from the page:

The recommended way of using JavaFX is with Corretto 11 and pulling in OpenJFX separately e.g. with a Maven dependency. The latest version (currently 14) is compatible with Corretto 11. src: Corretto's github

jccampanero also here answered a similar question.

sciPher80s
  • 23
  • 4
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 07 '22 at 12:33