NullPointerException

Hello, I have in my main GameClient.java this code:

[java]private void createCharacter() {

Prueba prueba = new Prueba(mainGame);

}[/java]

where mainGame is a private static GameClient variable.



Prueba.java looks like that:

[java]public class Prueba {

private Node rootNode;

private GameClient app;

private PhysicsSpace space;



public Prueba(GameClient app){

this.rootNode = app.getRootNode();

}

}[/java]



But when I try to run the main game client I’m getting this NullPointerException:



GRAVE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.NullPointerException

at org.bichomon.client.Prueba.(Prueba.java:21)

at org.bichomon.client.GameClient.createCharacter(GameClient.java:230)

at org.bichomon.client.GameClient.simpleInitApp(GameClient.java:156)

at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:228)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)

at java.lang.Thread.run(Thread.java:662)



Could anyone help me please? I need to call the rootNode from the GameClient java in the new Prueba.java



thanks in advance!

Is it that parameter app (mainGame) null?

1 Like

God… it was… I misspelled the variable in the main client



Thank you so much :stuck_out_tongue: