Lib GDX exported jar file does not detect assets

17 views Asked by At

so I built a jar file of my lib gdx project using the console command gradlew desktop:dist and it builds successfully. When I try to run it the program immediately crashes so I run it with a command line to get the console output and it seems that none of the assets are found so it fails. I use eclipse and it runs perfectly fine in the IDE, yes I set up properly my assets folder in my IDE and hooked it up to the build path and the strangest part about this is that if I open the exported jar file it actually contains all of my assets as it should. I run this code to get it:

FileHandle test = Gdx.files.internal("levels/default/level1.png");
        if (test.exists())
            System.err.println("exists!");

And of course, it does not find the file even though that exact directory exists and leads to the proper asset inside the jar file itself. Why is this not working, I also tried using the built-in java File type to get the file and it works fine in the IDE itself but the same problem with the exported jar.

0

There are 0 answers