AssetNotFoundException

I dunno really if I missed something obvious, but those assets doesn’t work for me. I created a folder assets in the project dir (where bulid, src and stuff are) and put a xml file in assets/Models/Test.



Then I use this code:

import com.jme3.app.SimpleApplication;

import com.jme3.font.BitmapText;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.Spatial;

import com.jme3.scene.shape.Box;



/** Sample 3 - how to load an OBJ model, and OgreXML model,

  • a material/texture, or text. */

    public class HelloAssets extends SimpleApplication {



    public static void main(String[] args) {

    HelloAssets app = new HelloAssets();

    app.start();

    }



    @Override

    public void simpleInitApp() {

    Spatial test = assetManager.loadModel("Models/Test/Test.mesh.xml");

    rootNode.attachChild(test);

    }

    }




    That yells a AssetNotFoundException. So do I have to use the IDE thingy to convert some stuff, or what are I supposed to do?

The assets folder has to be in the classpath. And yes, jMP sets that all up for you, so if you dont know what a classpath is then its best to use the SDK.

1 Like

I thought that the classpath was automatically set to the working directory. Maybe another kind of patch need to be set as well.



Okey, I am using Netbeans, adding the assets folder in the library should do the trick. But it doesn’t work!!!

Well I guess the executin folder is the same as the folder src is in, so you have to prefix your paths with “assets/”. But its ugly for distribution… Anyway Eclipse distributions are always ugly…

I would maybe be more clearer with that I use Netbeans, seem to doesn’t matter. That ugly trick doesn’t do the trick either, this is ridiculous! :stuck_out_tongue: How hard should it be to find find one directory! Someone would say “just use jMP…” but I wanna learn the hard way xD

Personally, I’d say, use jMP… get it working… and then try the hard way. Always better to move from working to not working and see what broke it.

I don’t really got the point why I should use jMP just because getting the models to work.



Okey, this doesn’t even works on jMP, really strange…

Maybe I need more thatn a xml file…

See… that was sort of my point. If it doesn’t work on jMP then there are larger issues. Get it to work where it works for so many other people and then you can work out what’s up in the different environment. As you put it “the hard way”.



I wasn’t suggesting that you stay on jMP… just that it’s an easy way to debug issues like this.

I am pretty sure jMP drops out all mesh.xml models out of the build so you cannot access them. You’re supposed to convert them to J3O format

Yes, but thats only relevant when you actually run it from the jar file, in all other cases the assets directory is actually in the classpath, not the assets.jar (which does not contain OgreXML files).

Okey, I get it to work now, thank you. First I tried to load the project I created in netbeans. That won’t work. So I created a new project and just copypasted the code. That worked. But it would be nice to get it working in netbeans aswell, seem kinda pointless to have two big IDE when I can have one. Maybe I can just open the project what I created in jMP in netbeans and that will work.



EDIT: Nope, that won’t work. Maybe netbeans are running the jar file or something.

Personally, I dont see the point in doing everything in one IDE. For example I have NetBeans 6.8 for PHP programming only, NetBeans 6.9.1 for Java, jMP for Games and Eclipse for JavaCard programming. I feel the IDE gets bloated and I have too many different projects open when I try to do all in one version… Then I maybe want to update for having new java stuff and suddenly my PHP or Game projects break because of another thing… So I personally prefer multiple IDE’s over one bloated one.