Could Not Load Textures From Assets In FXGL

903 Views Asked by At

I want to make a 2D game for a project that belongs to my university. So I decided to use JavaFX and FXGL library. I got a test basic project from FXGL Git repository and tried to run it. When I run this project FXGL warns that it could not load texture bucket.png. Here is the complete log message:
19:54:36.901 [FXGL Background Thread 1 ] WARN FXGLAssetLoaderServi - Failed to load texture bucket.png Error: java.lang.IllegalArgumentException: Asset "/assets/textures/bucket.png" was not found!

Here is my project structure:
enter image description here

I use Oracle JDK 14, OpenJFX 15, Gradle as build tool and IntelliJ IDEA

And module-info.java class:

module hellofx {
    requires com.almasb.fxgl.all;

    exports org.openjfx;
}
1

There are 1 best solutions below

1
Amir Victor On

After spending several hours for finding the problem, as @Slaw mentioned in the comments section, I found that module descriptor file (module-info.java) should be changed to the following format:

open module hellofx {
    requires com.almasb.fxgl.all;
}