0
\$\begingroup\$

Relevant background information

I'm developing a game in Java & LibGDX. Well, I started a project. I made a game with LibGDX about a year ago before. I made a new project with the Gradle setup and imported it into eclipse. I ran it and it didn't work

The problem

In the basic template it displays the badlogic image. It says it's not there or it can't find it.

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: badlogic.jpg
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:148)
at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
at com.kymed.dank.rpg.GameState.create(GameState.java:16)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: badlogic.jpg (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:145)

Though it's in the assets folder

\$\endgroup\$
  • \$\begingroup\$ Make sure your assets are set correctly in eclipse stackoverflow.com/a/26195973/5007340 \$\endgroup\$ – exenza Jan 10 '17 at 2:45
  • \$\begingroup\$ @exenza didn't work, eclipse said it's already there or something like that. Didn't let me add. \$\endgroup\$ – helpztheme Jan 10 '17 at 3:12
  • \$\begingroup\$ Did you import the project by gradle or by existing projects ? \$\endgroup\$ – Sebastien Servouze Jan 10 '17 at 8:20
  • \$\begingroup\$ Are you trying to run the Desktop version of your game? \$\endgroup\$ – bornander Jan 10 '17 at 10:48
  • \$\begingroup\$ Yeah @bornander \$\endgroup\$ – helpztheme Jan 10 '17 at 22:19
2
\$\begingroup\$

Make sure you set the working directory of your runtime configuration for the desktop launch to the assets folder, if you have included Android in your project. Otherwise, the assets folder should be core/assets.

If that does not fix it, then catch the exception under the debugger, and inspect its nested exception for clues.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.