The code looks something like this:
if (Gdx.app.getType() == ApplicationType.Android) path = "data/images/";
if (Gdx.app.getType() == ApplicationType.Desktop) path = "./bin/data/images";
(if i use "data/images/" for Desktop, i get a crash).
assetmanager.load(path + fileName)
, assetmanager.finishLoading()
and later assetmanager.get(path + fileName)
works perfectly in Eclipse and also on Android, but when i create a runnable .jar and launch it from console, i get Asset not loaded: ./bin/data/images/image.jpg
. So for some reason it cannot access the data folder inside my .jar archive. How do i fix this?
Thanks!
Well, it appers that when using Gdx.files.internal("data/images/").list()
on a desktop app, it always returns an empty list. I guess ./bin/data/images/
was not affected by that. That is also why "data/images/"
only worked on Android. The solution is to add every image manually, instead of looping through the folder. Thank you for your help!