0

Im trying to load a tiled map in libGDX with

tileMap = new TmxMapLoader().load("maps/level1.tmx");

but somehow it returns a File not found exception:

Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: maps\level1.tmx (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.reader(FileHandle.java:164)
at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:81)
... 9 more

I already tried to change the path to "/maps/level1.tmx" and other things but nothing works. It returns the file not found exception every time. Can someone see the error?

The path to the .tmx file is:

assets/maps/level1.tmx

the orginal assets folder is in the android project and in every project, the assets folder is linked..

  • Did you put it into your `assets` directory? – Thomas Jun 09 '14 at 15:38
  • Yes ^^ Its in the assets folder in the android project and it also shows up in the assets folder of the desktop project. – user3650337 Jun 09 '14 at 15:41
  • 1
    What does the following say: Gdx.files.internal("maps/level1.tmx").file().getAbsolutePath(); and where does the file actually exist? – Jyro117 Jun 09 '14 at 15:54
  • I copied the assets folder in the desktop project, used Gdx.files.internal("maps/level1.tmx").file().getAbsolutePath() and now it works :) thx – user3650337 Jun 09 '14 at 16:08
  • 3
    You should not use the absolute path, it isn't portable. I was just suggesting a way to determine if the path was actually what you were expecting it to be. Correcting the relative path is the proper fix. – Jyro117 Jun 09 '14 at 17:10

0 Answers0