AssetNotFoundException in Distribution

Hi,

When I build my project to distribute it the (currently only) asset I’m using won’t load. It works fine from the SDK. I’ve tested it with a new project where all it does is load the model with a Spatial model = assetManager.loadModel(<whatever the filepath was>); and it works fine from the SDK but breaks from the distribution MyGame.jar. From the thing on this website for distributing projects, as far as I can tell, all I have to do is press build and the assets should be bundled so I’m not sure what to do.

Thanks for any help.

Convert the model to j3o

And the part of your code that we can see looks fine to me.

It’s already a .j3o file I think. I created a new project using the BasicGame template then imported the model with the import model button. Here is the complete code.

[java]package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.scene.Spatial;

public class Main extends SimpleApplication {

public static void main(String[] args) {
    Main app = new Main();
    app.start();
}

@Override
public void simpleInitApp() {
    Spatial model = assetManager.loadModel("Models/Spaceship/Spaceship.j3o");
    
}

}[/java]

Try a clean&build, unless you got the case of the name wrong or the model isn’t there it should work.

Clean and Build didn’t work and it works if I just press run so the model filepath should be correct. One thing I did just notice were a couple of red lines in the output:

warning: [options] bootstrap class path not set in conjunction with -source 1.5
1 warning

and

Not copying library /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/assets , it’s a directory.

Is one of them the problem?

In case it helps, here is the entire output:

ant -f /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame clean jar init: deps-clean: Updating property file: /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build/built-clean.properties Deleting directory /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build clean: init: deps-jar: Created dir: /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build Updating property file: /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build/built-jar.properties Created dir: /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build/classes Created dir: /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build/empty Compiling 1 source file to /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build/classes warning: [options] bootstrap class path not set in conjunction with -source 1.5 1 warning compile: Created dir: /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/dist Copying 1 file to /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/build Not copying library /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/assets , it's a directory. Copy libraries to /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/dist/lib. Building jar: /Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/dist/MyGame.jar To run this application from the command line without Ant, try: java -jar "/Users/Joshua/Documents/Programming/jMonkeyStuff/BasicGame/dist/MyGame.jar" jar: BUILD SUCCESSFUL (total time: 0 seconds)

I just restarted the IDE (I can’t believe I didn’t think to do this earlier) and it fixed it.

Thanks