Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load resources after modularized #5

Open
LaiZhou opened this issue Feb 10, 2020 · 7 comments
Open

Can't load resources after modularized #5

LaiZhou opened this issue Feb 10, 2020 · 7 comments

Comments

@LaiZhou
Copy link

LaiZhou commented Feb 10, 2020

<plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.4</version>
                <configuration>
                    <stripDebug>true</stripDebug>
                    <compress>2</compress>
                    <noHeaderFiles>true</noHeaderFiles>
                    <noManPages>true</noManPages>
                    <release>${source.version}</release>
                    <jlinkImageName>FlappyBird</jlinkImageName>
                    <launcher>FlappyBird</launcher>
                    <mainClass>FlappyBird/com.almasb.fxglgames.flappy.FlappyBirdApp</mainClass>
                </configuration>
            </plugin> 

I used jlink to generate executable binary , but when I execute command ,it reported the error:

Failed to load texture bird.png Error: java.lang.IllegalArgumentException: Asset "/assets/textures/bird.png" was not found!

How to generate the correct executable binary on Windows?
I want to get an .exe file finally.

@LaiZhou
Copy link
Author

LaiZhou commented Feb 10, 2020

found a related issue. AlmasB/FXGL#644

@LaiZhou
Copy link
Author

LaiZhou commented Feb 10, 2020

Update.

module FlappyBird {
  requires com.almasb.fxgl.all;
  opens assets.music;
  opens assets.sounds;
  opens assets.textures;

  opens com.almasb.fxglgames.flappy;
  exports  com.almasb.fxglgames.flappy;
}

I try to create every sub-pakcage of assets ,and opens them, it reported new error:

[JavaFX Application Thread] WARN  AssetLoader          - Failed to load sound jump.wav Error: java.lang.UnsupportedOperationException: Unsupported protocol "jrt"

It seems like an openJdk bug.

@LaiZhou
Copy link
Author

LaiZhou commented Feb 11, 2020

@AlmasB

@AlmasB
Copy link
Owner

AlmasB commented Feb 11, 2020

Hi, you can open the module without opening each asset. So,

open module ...{

}

@LaiZhou
Copy link
Author

LaiZhou commented Feb 11, 2020

open module FlappyBird {
  requires com.almasb.fxgl.all;
  exports  com.almasb.fxglgames.flappy;
}

@AlmasB
I tried it, still failed, it showed the same error.
The steps.
execute the command

mvn clean install
mvn javafx:jlink

run the FlappyBird.bat

@AlmasB
Copy link
Owner

AlmasB commented Feb 11, 2020 via email

@AlmasB
Copy link
Owner

AlmasB commented Feb 11, 2020

Yes, with open module I also get Unsupported protocol "jrt". I seem to recall that javafx-media is not yet available natively, which is likely what's causing the issue. For more details, you can talk to the Gluon team, I think they are releasing the native javafx-media support soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants