[SOLVED] AssetManager error

Hi!

i’am use Eclipse

dependency
org.jmonkeyengine
jme3-core
3.3.2-stable

private AssetManager assetManager;

public void build() {
    assetManager = new DesktopAssetManager();
    assetManager.registerLocator(null, FileLocator.class);
    Node loadedNode = (Node) assetManager.loadModel("D:\\Model\\MyModel.j3o");

Exception in thread “main” com.jme3.asset.AssetLoadException: No loader registered for type “j3o”

i’m not use SimpleAplication, it’s stand alone class

1 Like

The argument to loadModel() appears to be incorrect. You’ve passed it an absolute filepath, whereas it expects an “asset path”, meaning a path relative to the asset root.

Since your code doesn’t add any locators to the asset manager, there’s no asset root. You can add locators using assetManager.registerLoader().

1 Like

I think if you need to load a custom directory URL outside of jme context use DesktopAssetManager(URL configFileURL) constructor(it registers locators for you based on the assets extensions inside that dir) like what jme LegacyApplication does :

But i have no idea what does the AssetConfigURL key refers to in the AppSettings HashMap Manager…

The constructor :

it’s worked for me
thx Kaljakoppa
assetManager.registerLoader(BinaryLoader.class, “j3o”);

2 Likes

The j3o loader is always registered by default unless you get your asset manager from a very strange place.

Edit: ah, I see you made your own… but why?

Edit 2: if you pass ‘true’ to new DesktopAssetManager() then it will register the default loaders (j3o won’t be the only one you are missing)… but I still wonder why you needed to instantiate your own.

1 Like

Is the error solved?

Yes, it’s solved
assetManager = new DesktopAssetManager(true);
is worked for me

1 Like