Asset not found fresh installation

Hi everyone. I just started using the SDK instead of the engine but I am familar with Jmonkey. I did a fresh install, created a new Gradle game, added the necessary jars in build.gradle, imported some models and it will not load any of them no matter what I do. The show up fine in the scene explorer but when running the application I get an exception.

com.jme3.asset.AssetNotFoundException: Models/town/town.j3o
	at com.jme3.asset.DesktopAssetManager.loadAsset(
	at com.jme3.asset.DesktopAssetManager.loadModel(
	at com.jme3.asset.DesktopAssetManager.loadModel(
	at com.mygame.states.PlayState.initialize(
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(
	at java.base/

The offending code.

// The town
Spatial town = assetManager.loadModel("Models/town.j3o");
town.addControl(new RigidBodyControl(0f));

As you can see, the file exists exactly where it should be and I noted that it also exists in the Gradle dependencies as well.


I have no idea what is going on and could use some help.

1 Like
1 Like

Not sure this is the best way, but it is how I get the SDK to work better with the Assets project. I add:

runtimeOnly project(':assets')

to the

dependencies {}

block of build.gradle in the main project


Also, when you run a Gradle project with the default build.gradle you’ll notice a bunch of Warnings / Errors output to the Console. To fix / suppress these, you can also add the following:

implementation "org.jmonkeyengine:jme3-plugins:$jmeVer"
implementation "org.jmonkeyengine:jme3-jogg:$jmeVer"

to the

dependencies {}

block of build.gradle


Thanks everyone. I registered the path with the FileLocator class which solves the problem but this should not be necessary. I just don’t know enough about the gradle build files to understand what is missing.

Gradle is a module based building tool, any module (folder) implemented would be on the project path.

So, in this case @peedeeboy has implemented the asset folder as an additional module.

Another way to fix this is packaging the assets into a jar file and referencing the jar relative path (the path from the current directory) in the game jar Manifest using a jar building task (in this case also the asset folder would be available at the project root dir), but this won’t help with testing the project at runtime, so @peedeeboy has so far introduced a better solution.

1 Like