I am trying to use assetManager.loadAsset to access png files to use as icons for my program. However, I keep getting a NullPointerException on the lines where I do so. Is my path wrong, or can I simply not use assetManager for this?
I am still somewhat new to jme3, so please bear with me if this is a stupid question.
(Also: I was using ClassLoader to load the images earlier but had complications with the images’ library folder being deleted when I made the project’s jar with Clean and Build - but thats a whole other issue)
Is this being called before the app is started? The asset manager isnt running if the app hasnt started. I cant remember off the top of my head but i believe you use the classloader and image.io to load icons. At work so i dont have the correct code in front of me.
You were having trouble with the folder, put the icons in a package on your classpath not in assets
Thanks, that’s what I suspected the issue was. I was able to get classLoader working for my icons only to an extent. When I built the JAR file with the “Clean and Build,” the folder I stored the image files in got deleted because the IDE said:
Not copying library D:\Documents\Java Game Projects\BasicGame\build\resources , it can’t be read.
I couldn’t find any forum posts or documentation as to why it deletes the folder - maybe I’m supposed to be placing the folder elsewhere or as a package(?). Let me know if you know the answer. Maybe I should delete this post and make a new one regarding the folder deletion issue.
Wow ok I had no idea what I was doing ealier (honestly, I still dont completely). I followed your instructions but was still having trouble getting the images included in the build. The last thing I tried was adding a package of the images in Source Packages - somehow it works! Thanks for your help