OBJ loading error

Hi all people,



I have a problem.

I want to load a model as OBJ, but I'm having problems with this line:



converter.convert(objFile.openStream(),BO);

I get this error :  java.lang.NullPointerException



The model format is OBJ, and is exported with Blender. Any idea?  :?

Well, a NullPointer is pretty specific. One of the Objects used in that line is null. Check which one…

I have the problem with Convert() and SetProperty()



Lets see, I use:



converter.setProperty("mtllib",objFile);

converter.convert(objFile.openStream(),BO);



And this is the convert Method:



Converts an .obj file to .jme format. If you wish to use a .mtl to load the obj's material information please specify the base url where the .mtl is located with setProperty("mtllib",new URL(baseURL))



Now, the problem is that I don't know how to work with setProperty, 'mtllib', new URL, and "base URL"  :|

Any tip?



Edit:

I have to say that I use only one URL, and it is Base URL. Line:



URL objFile=TestObjJmeWrite.class.getClassLoader().getResource("jmetest/data/model/x.obj");



Edit 2:



I'm testing it with TestObjJmeWrite.java (Maggie simpson example).

can you post the code? Its hard to track down an NPE when you can't see how all of the objects are being made :wink:

Sure! There is: TestObjJmeWrite.java  

It works. The problem only comes when I change the OBJ file.

Well, this is the code that works, isnt it? I suppose you just change the string "jmetest/data/model/maggie.obj" to a path on your computer. That cannot work. A classpath has to be given here. Or you create an URL from a file like this:

new File("/my/path/and/file.obj").toURL();

Normen you are awesone. oh my god. It works! Thank you!!!

Thanks to sbook too.