Application Desktop no Project Assets in zip

I didn’t found a SDK category so I post it to Troubleshooting.

My problem I have is that in my build application zip file the asset folder is empty. I did it the following way:

  • Open Project Properties
  • Click on Application/Desktop
  • Selected all including “Bundle JRE with Applications”
  • I did not specify a JRE Version
  • Clicked ok
  • Made a clean build

Everything seems build (excluding MacOSX but that is an other story and maybe worth a ticket on github.

I have all zip files. I tried the Linux x86 64 bit zip. And the asset folder does not exist.

Is there something I have to do to have alsoe the Asset Folder?

More infos:

Product Version: jMonkeyEngine SDK 3.1.0-test-SNAPSHOT
Updates: jMonkeyEngine SDK is updated to version NetBeans 8.1 Patch 1
1 Like

My workaround is unzip, copy asset folder, zip again. What I’m not sure is, is this a SDK bug or just me make things the wrong way?
I think im not on the latest SDK, maybe with a newer one its fixed…

The assets are packed in an assets.jar in the lib folder - there is no assets folder in a deployed app.

Thanks @normen that explains a lot. I have my level descriptions (json) files as well placed in the asset folder but get it directly from file system but maybe should go over asset manger some how.
Does some one have as sample by any chance?

If there are in the assets.jar then you can also just load them as class resources. I’d provide a code snippet but I don’t know your directory structure… well, here is how you’d do it for a texture.

InputStream in = someClass.getClassLoader().getResourceAsStream(“/Textures/foo.png”);

You could use the asset manager. I half remember there was a tutorial but maybe not. I remember when I did it with my own maps once it only took me 15 minutes to figure out how. Just register a custom AssetLoader basically that returns your loaded object.


cool thanks I give it a try as soon I find time. Funny you can just take any class for it. And I think the Jackson Lib wants a inputstream any way.
What would be the benefit of using the jme asset manager? caching?

Yeah, though you might have to implement a particular interface to get proper caching… but mostly you get the ability to treat these like any other asset in not caring how they were packaged. ie: you could easily register other asset locators and so on and still find your stuff. (For example, if you wanted to support user-provided content for these.)

As I did not know this resource approach, I maybe did more things wrong. So I have my json files which describe my level (tiles, items, doors, opponents, actors). I placed this under

assets/Scenes/blabla.doors. json

So far no problem, I can get that as resource as @pspeed proposed above. But I also have a save game functionality and as I thought this assets are in an installation also just a folder and not in assets.jar file I saved my game state as follow

assets/Scenes/current/blabla.doors. json

And that I guess I can not store in the assets.jar obviously so this will still go in to the filesystem and loading again I assume I can not do with the approach of @pspeed with this getResourceAsStream() method.

And that will make my save/load logic more complicate. I also do not assume I can sove it with an own asset loader.

My current conclusion is I need to separate this in an own folder outside assets folder and I need somehow make the SDK aware of that folder so that it goes into that zip file. But chances are that I’m still terrible wrong and the resourced loader thing is still the better approach, I don’t know honestly.

Depending on what you store you can simply store it in the AppSettings object, or use the java Preferences tools: Preferences (Java Platform SE 7 )