Jump to content
  • Advertisement
Sign in to follow this  

LibGDX animation error

This topic is 683 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I try to load in my animation picture I get an error.


    public void create() {        
        batch = new SpriteBatch();
        textureAtlas = new TextureAtlas(Gdx.files.internal("data/anim.png"));
        animation = new Animation(1/15f, textureAtlas.getRegions());
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: File not found: data\anim.png (Local)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:103)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:231)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:226)
at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:216)
at com.mygdx.anim.RunThisOne.create(RunThisOne.java:20)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
The file is correctly (to my knowledge) implemented into the project inside the "assets" folder.
I've tried changing "internal" to "local".
Please help

Share this post

Link to post
Share on other sites

Yeah basically it's just not finding the file for some reason.


Based on what I see there the file needs to be located at: assets/data/anim.png

And the assets folder itself should be located either in the root of your project or working directory, or on your classpath.


So if you're executing from commandline then it could be due to your current working directory not being at the root of the project.


If you're running directly from within your IDE then it's more likely a classpath issue. In Eclipse you may need to add the assets folder to your build path or convert it into a "source" folder (right click -> Build Path -> Use as source folder).

Edited by dmatter

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!