1

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;
}
Amir Victor
  • 181
  • 1
  • 7
  • What happens if you add an `opens assets.textures;` directive to your module-info file? – Slaw Jan 30 '21 at 19:17

1 Answers1

3

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;
}
Amir Victor
  • 181
  • 1
  • 7
  • Then your problem had to do with "resource encapsulation", described [here](https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Module.html#getResourceAsStream(java.lang.String)). – Slaw Jan 30 '21 at 20:48