I am trying to use the example for importing a model from Blender.
http://www.jmonkeyengine.com/wiki/doku.php?id=importing_models_from_blender
here is the code I am using the the errors I am receiving:
package universityTutorials;
import com.jme.app.SimpleGame;
import com.jme.scene.shape.Box;
import com.jme.math.Vector3f;
/*
The SimpleGame class is a simple
implementation of the game loop and
allows beginning jME programmers to
develop simple applications. It will
automatically render the scene graph
defined in the simpleInitGame method.
The simpleInitGame method is abstract
and must be defined whenever
SimpleGame is extended.
/
import com.jme.scene.Node;
import com.jmex.model.XMLparser.;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
public class Example1 extends SimpleGame {
public static void main(String[] args) {
Example1 app = new Example1();
app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
protected void simpleInitGame() {
Box b1;
//The Vector3f objects will be used to
//hold the x, y and z coordinates for the
//box.
Vector3f v1 = new Vector3f(1, 1, 1);
Vector3f v2 = new Vector3f(5, 5, 15);
//A Box object is being constructed with the
//following parameters:
// The name is
class file has wrong version 50.0, should be 49.0
You are using a class that has been compiled for java 6 but you are using java 5. Where did you get the XMLtoBinary class from?
hevee said:
You are using a class that has been compiled for java 6 but you are using java 5.
I got the jar files from this google link http://code.google.com/p/jmexml/downloads/list.
I think I know what you mean by "using java 5". Are you saying I need to update my JDK from 5 to 6? or the JRE from 5 to 6?
gr4yF0X said:
I think I know what you mean by "using java 5". Are you saying I need to update my JDK from 5 to 6? or the JRE from 5 to 6?
Updating both JDK and JRE will help if that is possible for your system. You could also check out the source code from the jmexml project and compile it with your java 5 JDK - but depending on how much experience you have with stuff like that just updating your java installation might be easier to do.
It worked! Updating Java allows me to compile the application! Thanks!
However now I receive this error when I try to run the application:
Aug 18, 2008 11:28:39 AM com.jme.app.BaseGame start
INFO: Application started.
Aug 18, 2008 11:28:39 AM com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
Aug 18, 2008 11:28:39 AM com.jme.system.PropertiesIO load
INFO: Read properties
Aug 18, 2008 11:28:45 AM com.jme.system.PropertiesIO save
INFO: Saved properties
Aug 18, 2008 11:28:45 AM com.jme.app.BaseSimpleGame initSystem
INFO: jME version 1.0
Aug 18, 2008 11:28:45 AM com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
Aug 18, 2008 11:28:45 AM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
Aug 18, 2008 11:28:45 AM com.jme.renderer.lwjgl.LWJGLRenderer <init>
INFO: LWJGLRenderer created. W: 640H: 480
Aug 18, 2008 11:28:45 AM com.jme.app.BaseSimpleGame initSystem
INFO: Running on: ialmrnt5
Driver version: 6.14.10.4363
Intel - Intel 915GM - 1.4.0 - Build 4.14.10.4363
Aug 18, 2008 11:28:45 AM com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
Aug 18, 2008 11:28:45 AM com.jme.util.lwjgl.LWJGLTimer <init>
INFO: Timer resolution: 1000 ticks per second
Aug 18, 2008 11:28:45 AM com.jme.scene.Node <init>
INFO: Node created.
Aug 18, 2008 11:28:45 AM com.jme.scene.Node <init>
INFO: Node created.
Aug 18, 2008 11:28:45 AM com.jme.scene.Node attachChild
INFO: Child (FPS label) attached to this node (FPS node)
Aug 18, 2008 11:28:45 AM com.jme.scene.Node attachChild
INFO: Child (box) attached to this node (rootNode)
Aug 18, 2008 11:28:45 AM class universityTutorials.Example1 start()
SEVERE: Exception in game loop
java.lang.NullPointerException
at universityTutorials.Example1.simpleInitGame(Example1.java:69)
at com.jme.app.BaseSimpleGame.initGame(Unknown Source)
at com.jme.app.BaseGame.start(Unknown Source)
at universityTutorials.Example1.main(Example1.java:31)
Aug 18, 2008 11:28:45 AM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Aug 18, 2008 11:28:45 AM com.jme.app.BaseGame start
INFO: Application ending.
Sorry to be such a bother and I really appreciate your time. Also this is line 69 that seems to be creating the error:
converter.sendXMLtoBinary(modelURL.openStream(), BO);
That just means that modelURL is null. Apparently
URL modelURL = this.getClass().getClassLoader().getResource(XMLFileName);
can't find the file where you think it is. If you are unsure about why this might be, you should take some time and get familiar with the java classpath and how exactly resources are located.
Oh, and please use [ code ] tags when posting code and logs, it will help people read your posts and get you more answers :)
You were right, I figured the xml file needed to just be in the project folder. So I have file path corrected and now I am able to run the application. I attached the node to the rootNode and now I can see the car! Again thanks for the help!