StandardGame runtime exception

trying to get the very basic stuff working for StandardGame:



public static void main(String[] args) {

        StandardGame game = new StandardGame("Icarus Instance Server", StandardGame.GameType.HEADLESS);

        game.start();

     

        DebugGameState state = new DebugGameState();

        GameStateManager.getInstance().attachChild(state);

// Activate the game state

state.setActive(true);

    }



and i get this output:



Apr 26, 2007 1:51:53 PM com.jmex.game.state.GameStateManager create

INFO: Created GameStateManager

Apr 26, 2007 1:51:53 PM com.jme.scene.Node <init>

INFO: Node created.

Apr 26, 2007 1:51:54 PM com.jme.scene.Node <init>

INFO: Node created.

Apr 26, 2007 1:51:54 PM com.jme.scene.Node attachChild

INFO: Child (Text) attached to this node (TextNode)

Apr 26, 2007 1:51:54 PM com.jme.scene.Node <init>

INFO: Node created.

Apr 26, 2007 1:51:54 PM com.jme.input.joystick.DummyJoystickInput <init>

INFO: Joystick support is disabled

Apr 26, 2007 1:51:54 PM com.jme.input.lwjgl.LWJGLMouseInput <init>

WARNING: Problem during creation of Mouse.

java.lang.IllegalStateException: Display must be created.

at org.lwjgl.input.Mouse.create(Mouse.java:280)

at com.jme.input.lwjgl.LWJGLMouseInput.<init>(Unknown Source)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at com.jme.input.MouseInput.get(Unknown Source)

at com.jme.input.mouse.TriggersMouseInputListener.activate(Unknown Source)

at com.jme.input.mouse.MouseInputHandlerDevice.getMouseListener(Unknown Source)

at com.jme.input.mouse.MouseInputHandlerDevice$MouseAxisTrigger.<init>(Unknown Source)

at com.jme.input.mouse.MouseInputHandlerDevice.createTriggers(Unknown Source)

at com.jme.input.InputHandler.addAction(Unknown Source)

at com.jme.input.RelativeMouse.registerWithInputHandler(Unknown Source)

at com.jme.input.MouseLookHandler.<init>(Unknown Source)

at com.jme.input.FirstPersonHandler.<init>(Unknown Source)

at com.jmex.game.state.DebugGameState.init(Unknown Source)

at com.jmex.game.state.DebugGameState.<init>(Unknown Source)

at com.jmex.game.state.DebugGameState.<init>(Unknown Source)

at net.interaxia.icarus.core.IcarusInstanceServer.main(IcarusInstanceServer.java:56)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

Exception in thread "main" java.lang.NullPointerException

at com.jme.input.MouseLookHandler.<init>(Unknown Source)

at com.jme.input.FirstPersonHandler.<init>(Unknown Source)

at com.jmex.game.state.DebugGameState.init(Unknown Source)

at com.jmex.game.state.DebugGameState.<init>(Unknown Source)

at com.jmex.game.state.DebugGameState.<init>(Unknown Source)

at net.interaxia.icarus.core.IcarusInstanceServer.main(IcarusInstanceServer.java:56)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)



Process finished with exit code 143







i am using jME 0.11, JDK 1.6 on ubuntu feisty

Don't create a headless game with DebugGameState, it's meant specifically for visual debugging "in-game" and was never designed for headless mode so it's throwing an exception because it's trying to interact with the mouse (that's obviously not instantiated because it's in headless mode).



Try using BasicGameState instead, that should work for you.

darkfrog said:

Don't create a headless game with DebugGameState, it's meant specifically for visual debugging "in-game" and was never designed for headless mode so it's throwing an exception because it's trying to interact with the mouse (that's obviously not instantiated because it's in headless mode).

Try using BasicGameState instead, that should work for you.


indeed it does, thanks :)