AssetNotFoundException, but I copy the link and the txt file opens, how?

Hi!



I want to load a model like this:

Spatial model = MainClass.getAsset().loadModel(name+".mesh.xml");



But I get this:

com.jme3.asset.AssetNotFoundException: C:UsersÄgarenDesktopPixelPwnModelsHouse_1.mesh.xml

I copy the path that "doesn't exsist" into a folder that I have up. And then the House.mesh.xml opens up in notepad!

I'v checked that there is capital-correct and all. I really do no know why it's messing with me like this so can you help me?

Did u register the locale?

The fact that is shows a C: in the path is suspicious since the asset manager will be looking in the assets folder/jar and so the requested asset should be a relative path. Since you haven’t given us how name is set I’m only guessing.

I DID IT! :smiley:

Just in case that someone else has that problem, this way:

[java]

selectedFilePath = fileChooser.getSelectedFile().getName();

assetManager.registerLocator(fileChooser.getSelectedFile().getParentFile().getPath(), FileLocator.class);

[/java]

The Exception which was thrown after I already registered the Locator was caused because IN the registered Directory the assetmanager searched a file with the absolute filepath.

For example when I register:



C://Users//User Name//Documents//Projects



and the Filepath is



C://Users//User Name//Documents//Projects//image.png



the assetmanager searches:



C://Users//User Name//Documents//Projects//C://Users//User Name//Documents//Projects//image.png



I had to use the file name not the path.

Sorry for “reviving” this thread, but I have a similar problem.

The Model that shall be loaded is chosen with a JFileChooser

the asset manager will be looking in the assets folder/jar

Is there a way to solve this or isn't it possible?

read the manual. you’d have to register a locator at the filesystem root. still you’d have other issues.

you’d have to register a locator

I did that before and it didn't work.
I registered the parent directory and got the assetNotFound Exeption.

A JME Application put its assets into the assetfolder.
If I just copy the selected File into that folder and then load it, it should work...
BUT the running App gets its assets from the asset.jar...
and it's not possible to put a file into that jar, right?

So all in all I have no idea.

the issue is the path that you are trying to load with. it has to be part of the assetmanager root and “C:/Users/Ägaren/Desktop/PixelPwn/ModelsHouse_1.mesh.xml” isn’t