Fatal Error when closing StandardGame application?

Hello, i have a very simple StandardGame application, I can use it, it's all okay. But when i exit it, I get this fatal error message:

# A fatal error has been detected by the Java Runtime Environment:
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0451c059, pid=3780, tid=2924
# JRE version: 6.0_17-b04
# Java VM: Java HotSpot(TM) Client VM (14.3-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  [OpenAL32.dll+0xc059]
# An error report file with more information is saved as:
# C:Documents and SettingsUsuarioMeus documentosNetBeansProjectsJava Monkey Enginehs_err_pid3780.log
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp

And it create a a file called hs_err_pidXXXX.log

My code:

package jme.game;

import java.util.concurrent.Callable;

import com.jme.bounding.BoundingBox;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.scene.shape.Box;
import com.jme.system.DisplaySystem;
import com.jme.util.GameTaskQueueManager;
import com.jmex.editors.swing.settings.GameSettingsPanel;
import com.jmex.game.StandardGame;
import com.jmex.game.state.DebugGameState;
import com.jmex.game.state.GameStateManager;
import com.jmex.jbullet.PhysicsSpace;
import com.jmex.jbullet.collision.shapes.CollisionShape;
import com.jmex.jbullet.nodes.PhysicsCharacterNode;
import com.jmex.jbullet.nodes.PhysicsNode;

 * Jogo em primeira pessoa.
 * @autor Gustavo Borba
 * @data Segunda-feira, 12 de abril de 2010
public class Main {
    private static PhysicsCharacterNode character;
    private static Vector3f walkDirection = new Vector3f();

    public static void setupGame(){
        // creates and initializes the PhysicsSpace
        final PhysicsSpace pSpace=PhysicsSpace.getPhysicsSpace(PhysicsSpace.BroadphaseTypes.AXIS_SWEEP_3);

        // Create a DebugGameState
        // - override the update method to update/sync physics space
        DebugGameState state = new DebugGameState() {
        CollisionShape shape;

        // - Initialize Camera
        DisplaySystem display = DisplaySystem.getDisplaySystem();
        Camera cam = display.getRenderer().getCamera();

        public void update(float tpf) {

            cam.getLocation().set(character.getLocalTranslation().add(new Vector3f(0, 1.7f, 0)));



        Box player = new Box("Character", Vector3f.ZERO, new Vector3f(.5f, .5f, .5f));
        character = new PhysicsCharacterNode(player, CollisionShape.ShapeTypes.BOX, .1f);
        character.setLocalTranslation(10, .3f, 20);

        character.setModelBound(new BoundingBox());


        // The floor, does not move (mass = 0)
        Box floorNode = new Box("Floor", Vector3f.ZERO, new Vector3f(20, .2f, 40));
        PhysicsNode floor = new PhysicsNode(floorNode, CollisionShape.ShapeTypes.MESH, 0);

        floor.setModelBound(new BoundingBox());



    public static void main(String[] args) throws Exception {
        System.setProperty("jme.stats", "set");

        StandardGame game = new StandardGame("Standard Game - Jogo em primeira pessoa");
        if (GameSettingsPanel.prompt(game.getSettings())) {         
            GameTaskQueueManager.getManager().update(new Callable<Void>() {

            public Void call() throws Exception {
                return null;

Hope you guys can help me.

You should call StandardGame.finish() when exiting.

So instead of using DebugGameState, you could create your own Gamestate which has a reference to StandardGame to be able to gracefully quit.

So why wiki tutorial http://www.jmonkeyengine.com/wiki/doku.php?id=simplegame_to_standardgame&s=gametaskqueue said to use DebugGameState?

Its just an example, i guess it could be improved :slight_smile:

I have searched a lot, and I was not abl

I once made a patch to pass a AbstaractGame reference to the DebugGamestate constructor, but i was unsure if its the way to go and didn’t commit it yet.


You could also make the StandardGame reference available as a singleton, that way you also could call StandardGame.finish() when you want to exit your app.

Like i did it in Stardust: StandardGame wrapped as a Singleton