Problem with HelloModelLoading (rank noob)


new to java and new to jMe. I can't seem to get the model loading tutorial to run. It compiles fine then when I run it, the choices for screen parameters comes up, click continue then the window opens and closes without loading my model. From inside netbeans 5.0 when I try to run the build i get


        at HelloModelLoading.simpleInitGame(

        at Source)

        at Source)

        at HelloModelLoading.main(

I corrected what seems like a problem (jme vs. jmex), and the lwjgl.dll and others are in the PATH. What could I be doing wrong?

Check out the first line number in the stack trace (  I don't have the code in front of me, but I'll bet it is the line where the model is loaded which would indicate the model file was not available.  I don't use netbeans, but perhaps you need to tell it to copy across resources such as model files, image files, etc. when compiling?  I remember that being a problem back when I used JBuilder.

hi 300zxkyle

Have You modified HelloModelLoading ? as line 46 is an import statement for me ?

You know it's the problem renanse mentioned if the jme select display settings dialog does not show the jmonkey picture above the settings and You get

a message like "Could not load image…  URL was null." above Your stacktrace.

If this is the case then try to setup Your classpath to contain the directory above "jmetest"

i'd do it like:

Projects tab right click on jme project node,  select "properties" - from properties dialog Categories select "libraries"  -

from the tabbed pane in the right view select the "Run" tab - button "Add JAR/Folder" and here select (relative to jme base dir)

jme/src  (it's "C:netbeans_projectJMEjmesrc" on my win box) click ok.

Thus the classloader should be able to find "jmetest/data/model/maggie.obj"


Aha! the solution was to pack the model into the same *.jar as the maggie.obj. I was trying to use a model that I had stored under my documents. Is there anyway to use a model that is in the file system?

thanks for the help guys.

Sure, just create a URL with "file:///yourpath/file.obj" instead of searching it with the classloader.

or file.toURI().toURL();

I would just suggest file.toURL() but apparently that's deprecated now.  Far be it for them to just leave it in and just change it to call toURI().toURL()…that would be too easy! :-p